Laravel s3检查目录是否存在。(Laravel s3 check if directory exists.)
如果目录存在,我将如何检查Laravel storage ?
在文档中,只记录了如何检查文件是否存在。
Storage::disk('local')->exists('file.jpg');
https://laravel.com/docs/5.3/filesystem#retrieving-files
How would I check with Laravel storage if a directory exists?
In the documentation there is only documented how to check if a file exists.
Storage::disk('local')->exists('file.jpg');
https://laravel.com/docs/5.3/filesystem#retrieving-files
最满意答案
尝试在父目录中获取目录列表,并检查您要查找的目录是否在数组中:
in_array('directoryYoureLookingFor', Storage::disk('s3')->directories('parentDirectory'));我刚检查过,这个解决方案适用于Laravel 5.3。
Try to get directories list in a parent directory and check if the directory you're looking for is in an array:
in_array('directoryYoureLookingFor', Storage::disk('s3')->directories('parentDirectory'));I've just checked and this solution works in Laravel 5.3.
更多推荐
发布评论