【发布时间】:2018-01-18 09:36:18
【问题描述】:
我将文件存储在本地存储中。所以,在/storage/app/public 目录中。
我将我的文件存储在/storage/app/public/userId/images;
我使用了 php artisan storage:link ,所以我可以在视图中访问该文件,在 /public/storage/userId/images 中拥有此文件夹的快捷方式
在该路径内,我有 2 张图片 - test.jpg 和 test2.jpg
我在 Laravel 文档中找不到回复,如何从 /public/storage/userId/images 中删除文件 test.jpg
我试过这样:
$path = 'public/' . $id . '/diploma';
$files = Storage::files($path);
return $files;
它返回我:
[
"public/303030/images/test.jpg"
"public/303030/images/test2.jpg"
]
现在,我如何在该数组上调用Storage::delete('test.jpg')?
【问题讨论】: