Laravel符号链接不起作用

时间:2018-02-06 06:54:28

标签: laravel laravel-5.4 laravel-filesystem

我在使用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页面,因为我猜没有文件。

1 个答案:

答案 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);

希望这有助于你。

让我知道你是否有任何问题。

相关问题