将项目从Windows迁移到Mac后,出现此错误。
“ / private / var / folders / 6w / zypn4xb120l6x6f1kjx9_nxw0000gn / T / phpwroBVT”文件不存在或不可读。
这是我的代码
if($request->hasFile('image')){
$image = $request->file('image');
$image_name = $image->getClientOriginalName();
$destinationPath = public_path('/images/services');
$image->move($destinationPath, $image_name);
$summary = $request->summary;
$body = $request->body;
$title = $request->title;
$service = Service::create([
'title'=> $title,
'summary'=>$summary,
'body'=>$body,
'image'=> $image
]
);
if($service){
return redirect()->back()->with('success','services added');
}
}
图像进入public / images / services文件夹,但出现上述错误
答案 0 :(得分:0)
我遇到了类似的错误,发现我正在访问没有“ this”指针引用的控制器中声明的全局变量。例如
class BlogController extends Controller
{
public $attachment_folder_name = "/blogs/";
}
您应使用以下语法访问此变量。
echo $this->attachment_folder_name
不是这样
echo $attachment_folder_name