开始腾讯提交;

This commit is contained in:
2022-07-11 18:39:21 +08:00
parent 1e2c75fbbe
commit bfcb4ad321
7 changed files with 84 additions and 3 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace think\filesystem\driver;;
use League\Flysystem\AdapterInterface;
use Qcloud\Cos\Client;
use think\filesystem\Driver;
class Txcos extends Driver
{
protected function createAdapter(): AdapterInterface
{
$secretId = sysconfig('upload', 'txcos_secret_id');
$secretKey = sysconfig('upload', 'txcos_secret_key');
$region = sysconfig('upload', 'txcos_region'); //set a default bucket region 设置一个默认的存储桶地域
$cosClient = new Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials' => array(
'secretId' => $secretId,
'secretKey' => $secretKey
),
'signHost' => false
)
);
$bucket = sysconfig('upload', 'tecos_bucket'); //存储桶名称 格式BucketName-APPID
$adapter = new \Chunpat\FlysystemTencentCos\Adapter($cosClient, $bucket);
return $adapter;
}
}