作者 lyh

gx

... ... @@ -47,11 +47,12 @@ class TencentCosService extends BaseService
$contentType = 'image/'.$image_type;
date_default_timezone_set('Asia/Shanghai');
$date = date('D, d M Y H:i:s \G\M\T');
$expiredTime = time() + 3600000;
$expiredTime = ( time() - 60 ) . ';' . ( string )( strtotime( '+30 minutes' ) );
$filePath = $path.'/'.$fileName;
$stringToSign = "{$httpVerb}\n{$contentMd5}\n{$contentType}\n{$date}\n/{$this->config['bucket']}/{$filePath}";
$sign = base64_encode(hash_hmac('sha1', $stringToSign, $this->config['secretKey'], true));
$authorization = "q-sign-algorithm=sha1&q-ak={$this->config['secretId']}&q-sign-time={$expiredTime}&q-key-time={$expiredTime}&q-header-list=&q-url-param-list=&q-signature={$sign}";
$authorization =
"q-sign-algorithm=sha1&q-ak={$this->config['secretId']}&q-sign-time={$expiredTime}&q-key-time={$expiredTime}&q-header-list=&q-url-param-list=&q-signature={$sign}";
$url = "https://{$this->config['bucket']}.cos.{$this->config['cosRegion']}.myqcloud.com{$filePath}";
// 打开文件流
$filePathUrl = config('filesystems.disks.upload')['root'].$path.'/'.$fileName;
... ...