Laravel程序员

laravel config filesystems

2017-12-14  本文已影响30人  3275508ab630

filesystems.php

default 注释翻译:

    /*
    |--------------------------------------------------------------------------
    | 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'),
    /*
    |--------------------------------------------------------------------------
    | 默认文件系统磁盘
    |--------------------------------------------------------------------------
    |
    | 在这里您可以指定框架默认文件系统磁盘。
    | “本地”磁盘以及各种云存储都可用于您的应用程序 
    | 尽管存!
    |
    */

    'default' => env('FILESYSTEM_DRIVER', 'local'),

个人理解: Storage 默认操作的文件路径

cloud 注释翻译:

    /*
    |--------------------------------------------------------------------------
    | Default Cloud Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | Many applications store files both locally and in the cloud. For this
    | reason, you may specify a default "cloud" driver here. This driver
    | will be bound as the Cloud disk implementation in the container.
    |
    */

    'cloud' => env('FILESYSTEM_CLOUD', 's3'),
    /*
    |--------------------------------------------------------------------------
    | 默认的云文件系统磁盘
    |--------------------------------------------------------------------------
    |
    | 许多应用程序都在本地和云中存储文件。  
    | 出于这个原因,你可以在这里指定一个默认的“云”驱动程序。
    | 该驱动程序将被绑定为容器中的云硬盘实现。
    |
    */

    'cloud' => env('FILESYSTEM_CLOUD', 's3'),

个人理解: 默认云存储,鄙人没用过。

disks 注释翻译:

    /*
    |--------------------------------------------------------------------------
    | Filesystem Disks
    |--------------------------------------------------------------------------
    |
    | Here you may configure as many filesystem "disks" as you wish, and you
    | may even configure multiple disks of the same driver. Defaults have
    | been setup for each driver as an example of the required options.
    |
    | Supported Drivers: "local", "ftp", "s3", "rackspace"
    |
    */

    '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'),
        ],

    ],
    /*
    |--------------------------------------------------------------------------
    | 文件系统磁盘
    |--------------------------------------------------------------------------
    |
    | 在这里,您可以根据需要配置尽可能多的文件系统“磁盘”,
    | 甚至可以配置同一驱动程序的多个磁盘。
    | 已经为每个驱动程序设置了默认值,作为所需选项的一个例子。
    |
    | 支持的驱动程序:“本地”,“ftp”,“s3”,“rackspace”
    |
    */

    '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'),
        ],

    ],

个人理解:可以把每个磁盘看做文件夹类型,可以自定义多个文件夹用来存储相同类型的文件。默认配置推荐存储在 storage_path 下,public 磁盘对应的文件夹需要做软链 php artisan storage:link

上一篇 下一篇

猜你喜欢

热点阅读