Gia*_*o M 3 php laravel-5.2 laravel-storage
我不知道为什么我无法使用以下代码删除 Laravel 中的文件:
$path = storage_path('app/identification_cards') . '/' . $filename;
Storage::delete($path)
Run Code Online (Sandbox Code Playgroud)
该命令执行时没有错误,并返回 true。
我检查的内容:
- 路径正确。如果我在 bash 终端中使用相同的确切路径(使用“rm”命令),文件将被删除;
- 该文件确实具有 777 权限。
我不知道如何解决。
谢谢。
Storage::delete将指向storage\app\路径,因此无需再次添加应用程序文件夹名称
Storage::delete('identification_cards/'.$filename);
Run Code Online (Sandbox Code Playgroud)