Laravel 使用騰訊雲 cos 儲存物件

vinhson發表於2018-10-09

1、

composer require freyo/flysystem-qcloud-cos-v5

2、在config/app.php的providers下新增

Freyo\Flysystem\QcloudCOSv5\ServiceProvider::class,

3、在app/filesystems.php中的disks裡下新增

'disks'=>[
    // ...
    'cosv5' => [
          'driver' => 'cosv5',
          'region'          => env('COSV5_REGION', 'ap-guangzhou'),
          'credentials'     => [
              'appId'     => env('COSV5_APP_ID'),
              'secretId'  => env('COSV5_SECRET_ID'),
              'secretKey' => env('COSV5_SECRET_KEY'),
          ],
          'timeout'         => env('COSV5_TIMEOUT', 60),
          'connect_timeout' => env('COSV5_CONNECT_TIMEOUT', 60),
          'bucket'          => env('COSV5_BUCKET'),
          'cdn'             => env('COSV5_CDN'),
          'scheme'          => env('COSV5_SCHEME', 'https'),
    ],
],

4、在app/filesystems.php修改

   'default' => 'cosv5',

騰訊雲COS物件儲存 V5: https://github.com/xiaoxuan6/flysystem-qcl...
騰訊雲COS物件儲存 V4: https://github.com/xiaoxuan6/flysystem-qcl...
騰訊雲COS物件儲存 V3: https://github.com/xiaoxuan6/flysystem-qcl...

部落格地址:http://blog.jstm365.com/

本作品採用《CC 協議》,轉載必須註明作者和本文連結
不要輕易放棄。學習成長的路上,我們長路漫漫,只因學無止境 Don't give up easily. On the way of learning and growing up, we have a long way to go, just because there is no end to learning.

相關文章