我尝试使用以下方法创建一个带有子目录的文件夹(如果该文件夹尚不存在):
public function createFolderIfNotExist($path){
//Check if the folder already exists
if(!File::Exists($path)){
//make folder with $path generate recursive with right 0775
File::makeDirectory($path, 0775 , true);
}
}
运行本地语言时,它工作正常(xampp),当推送到服务器时,它返回
没有权限
错误的第一行
在Filesystem.php行337中
在HandleExceptions-> handleError('2','mkdir():权限被拒绝','/var/www/****/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php','337' ,array('path'=>'/ var / www / **** / public / images \ product \ 206','mode'=>'509','recursive'=> true,'force'=> false ))
在Filesystem.php第337行的mkdir('/ var / www / **** / public / images \ product \ 206','509',true)中
在Facade.php第216行的Filesystem-> makeDirectory('/ var / www / **** / public / images \ product \ 206','509',true)中
在Facade :: __ callStatic('makeDirectory',array('/ var / www / **** / public / images \ product \ 206','509',true))在ProductController.php第452行
该错误消息使它看起来像我正在尝试将权限设置为509
我通过的路径是:
$pathThumb = public_path('images\product\\'.$product->id.'\thumb');
在服务器上检查许可时,公用文件夹显示为775。
我究竟做错了什么?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句