【发布时间】:2018-05-03 17:08:00
【问题描述】:
我正在尝试将文件存储在公共文件夹 storage/app/public/ 中,但由于某种原因,Laravel 似乎只是将它放在私有文件夹 storage/app/ 中。
如果我理解正确,我应该将可见性设置为“公开”,但这似乎并没有改变任何东西:
Storage::put($fileName, file_get_contents($file), 'public');
当我调用 getVisibility 时,我会公开,所以这似乎工作正常:
Storage::getVisibility($fileName); // public
这些是我的 filesystems.php 中的设置:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_REGION'),
'bucket' => env('AWS_BUCKET'),
],
],
【问题讨论】:
标签: laravel file storage public