我有一个laravel项目,我想从该目录中删除图像
DriveView.setIncludeFolders()
myLaravelProject/public/images/banners
答案 0 :(得分:0)
为获得良好实践,您需要使用config/filesystems.php
中的新存储光盘来编辑配置:
'public_uploads' => [
'driver' => 'local',
'root' => public_path() . '/images/banners/',
]
然后
Storage::disk('public_uploads')->delete("{$image_name}");
答案 1 :(得分:0)
类似的事情对我有用:
use File;
$file_path = public_path(substr($this->path, 1));
if(File::exists($file_path)) {
File::delete($file_path);
}