|
...
|
...
|
@@ -43,6 +43,7 @@ class TencentCosService extends BaseService |
|
|
|
* @time :2023/7/18 16:56
|
|
|
|
*/
|
|
|
|
public function upload_image($path,$fileName,$image_type){
|
|
|
|
$contentType = 'image/'.$image_type;
|
|
|
|
$httpVerb = 'PUT';
|
|
|
|
$date = gmdate('D, d M Y H:i:s \G\M\T');
|
|
|
|
//生成 KeyTime
|
|
...
|
...
|
@@ -50,12 +51,9 @@ class TencentCosService extends BaseService |
|
|
|
//生成 SignKey
|
|
|
|
$signKey = hash_hmac( 'sha1', $signTime, trim($this->config['secretKey']) );
|
|
|
|
//生成 UrlParamList 和 HttpParameters
|
|
|
|
|
|
|
|
$filePath = $path.'/'.$fileName;
|
|
|
|
$stringToSign = "{$httpVerb}\n\n\n{$date}\n/{$this->config['bucket']}/{$filePath}";
|
|
|
|
$sign = hash_hmac( 'sha1', $stringToSign, $signKey );
|
|
|
|
var_dump($sign);
|
|
|
|
die();
|
|
|
|
$authorization =
|
|
|
|
"q-sign-algorithm=sha1&q-ak={$this->config['secretId']}&q-sign-time={$signTime}&q-key-time={$signTime}&q-header-list=&q-url-param-list=&q-signature={$sign}";
|
|
|
|
$url = "https://{$this->config['bucket']}.cos.{$this->config['cosRegion']}.myqcloud.com{$filePath}";
|
...
|
...
|
|