作者 lyh

gx

... ... @@ -47,8 +47,10 @@ 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');
$filePath = $path.'/'.$fileName;
$expiredTime = time() + 3600;
var_dump(date('Y-m-d H:i:s',$expiredTime));
die();
$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}";
... ...