我在使用laravel创建符号链接以访问存储中的文件时遇到了一些问题
我正在存储我的文件
storage\app\public
我使用php artisan命令创建链接
php artisan storage: link
The [public/storage] directory has been linked.
早期文件存储在storage\app\public
中,并且在public\storage
文件夹
但现在它们只存储在storage\app\public
中,而在public\storage
文件夹
我正在使用链接显示文件路径
{{ Storage::url($package->reportPath['path']) }}
路径显示正确但它重定向到404页面,因为我猜没有文件。
答案 0 :(得分:0)
如果您尝试显示存储的文件,请使用asset()
asset('storage/further_path/').$file_name;
存储您可以执行的文件
$destinationPath = storage_path('app/public/further_path');
if (!is_dir($destinationPath)) {
mkdir($destinationPath, 0777, TRUE);
}
$request->file->move($destinationPath,$filename);
希望这有助于你。
让我知道你是否有任何问题。