我在 storage/public 有一个图像,我想使用 Storage library 访问它,但我收到错误“在路径中找不到文件”
我在互联网上搜索了很多,但我的问题没有得到任何解决方案,所以请帮助我。
我的代码:
$filename = '123.jpg';
$path = storage_path()."/".$filename;
Storage::disk('local')->get($path);
dd($contents);
错误 :
Illuminate\Contracts\Filesystem\FileNotFoundException
C:\xampp\htdocs\admin\storage/123.jpg
我试过的东西:
php artisan storage:link
文件系统.php
<?php
return [
'default' => env('FILESYSTEM_DRIVER', 'local'),
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'permissions' => [
'file' => [
'public' => 0664,
'private' => 0600,
],
'dir' => [
'public' => 0775,
'private' => 0700,
],
]
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],
'links' => [
public_path('storage') => storage_path('app/public'),
],
];