Laravel符号链接不起作用

问题描述 投票:1回答:1

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

laravel laravel-5.4 laravel-filesystem
1个回答
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);

希望这有助于你。

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

© www.soinside.com 2019 - 2024. All rights reserved.