Laravel 文件存储位置
Laravel File Storage Location
我是 运行 我在 centos 上的 Laravel 项目,使用默认的 artisan 服务器。
我正在尝试使用 laravel File::append 命令向文件添加数据。
在 config/filesystems.php 我有以下内容:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('data'),
],
和
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
和 'FILESYSTEM_DRIVER' 未在 .env 文件中定义。
但是,当我使用 File::append() 时,文件是在 public 文件夹中创建的,而不是 storage_path
知道是什么原因造成的吗?我错过了什么。
虽然 Storage::put('filename.jpg', $contents);
使用默认文件系统,因此需要相对文件名,但 File::append
不需要。
因此,这里可能的解决方案是 File::append($path, 'yourAppend');
以及存储文件夹中文件的完整路径。
我是 运行 我在 centos 上的 Laravel 项目,使用默认的 artisan 服务器。 我正在尝试使用 laravel File::append 命令向文件添加数据。 在 config/filesystems.php 我有以下内容:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('data'),
],
和
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
和 'FILESYSTEM_DRIVER' 未在 .env 文件中定义。 但是,当我使用 File::append() 时,文件是在 public 文件夹中创建的,而不是 storage_path
知道是什么原因造成的吗?我错过了什么。
虽然 Storage::put('filename.jpg', $contents);
使用默认文件系统,因此需要相对文件名,但 File::append
不需要。
因此,这里可能的解决方案是 File::append($path, 'yourAppend');
以及存储文件夹中文件的完整路径。