Storage 保存文件

這邊只介紹FTP跟專案資料夾,關於如何架設FTP伺服器請點擊傳送門

設定

先做連接

php artisan storage:link

其它設定都在\config\filesystems.php如下:

<?php

return [

    'default' => 'ftp', // Supported: "local", "ftp", "s3", "rackspace"

    'cloud' => 'ftp', // 預設是'cloud' => 's3',

    'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'visibility' => 'public',
        ],

        's3' => [
            'driver' => 's3',
            'key' => 'your-key',
            'secret' => 'your-secret',
            'region' => 'your-region',
            'bucket' => 'your-bucket',
        ],

        'ftp' => [ // 你所架設的FTP的設定在這邊
            'driver'   => 'ftp',
            'host' => '192.168.30.212',
            'username' => 'root',
            'password' => '12347890',
        ],

    ],

];

功能

還有很多其他的功能,這邊只列出我用過的,其他的請點擊這個傳送門

Last updated

Was this helpful?