- 首先是composer安装依赖文件
composer require freyo/flysystem-qcloud-cos-v5
- config/app.php进行添加
'providers' => [
// ...
Freyo\Flysystem\QcloudCOSv5\ServiceProvider::class,
]
- 然后在filesystems 添加disk配置
'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'),
'read_from_cdn' => env('COSV5_READ_FROM_CDN', false),
],
],
- 配置.env:
COSV5_APP_ID=1252913248
COSV5_SECRET_ID=## cos5的配置SECRET_ID
COSV5_SECRET_KEY=##cos5的配置SECRET_key
COSV5_TIMEOUT=60
COSV5_CONNECT_TIMEOUT=60
COSV5_BUCKET=berger
COSV5_REGION=ap-shanghai
COSV5_CDN=https://berger-1252913248.cos.ap-shanghai.myqcloud.com
COSV5_SCHEME=https
COSV5_READ_FROM_CDN=false
- 接下来就大功告成,如果出现
laravel Driver [] is not supported.
那就
php artisan config:cache:
版权声明:本文为CSDN博主「羽灬翎」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_35075296/article/details/101165618