$path = '\upload\2021-04-02\******.jpg';
$path = substr($path,7);
Storage::disk('upload')->delete($path);
filesystem.php里的配置
'upload' => [
'driver' => 'local',
'root' => public_path('upload')
]
如果不加substr就会去找public\upload\upload......文件删除。就会导致删除失败。所以必须加上substr给一个正确的路径。