|
...
|
...
|
@@ -79,15 +79,16 @@ class TencentCosService extends BaseService |
|
|
|
$httpHeaders = rtrim($httpHeaders, "&");
|
|
|
|
//生成HttpString
|
|
|
|
$httpMethod = Str::lower($httpVerb);
|
|
|
|
$uriPathname = $path.'/'.$fileName;
|
|
|
|
$uriPathname = \request()->getPathInfo();
|
|
|
|
$httpString = $httpMethod . "\n" . $uriPathname . "\n" . $httpParameters . "\n" . $httpHeaders . "\n";
|
|
|
|
//生成 StringToSign
|
|
|
|
$sha1String = sha1($httpString);
|
|
|
|
$stringToSign = "sha1\n" . $keyTime . "\n" . $sha1String . "\n";
|
|
|
|
$filePath = $path.'/'.$fileName;
|
|
|
|
$sign = hash_hmac( 'sha1', $stringToSign, $signKey );
|
|
|
|
$authorization =
|
|
|
|
"q-sign-algorithm=sha1&q-ak={$this->config['secretId']}&q-sign-time={$keyTime}&q-key-time={$keyTime}&q-header-list=&q-url-param-list=&q-signature={$sign}";
|
|
|
|
$url = "https://{$this->config['bucket']}.cos.{$this->config['cosRegion']}.myqcloud.com{$uriPathname}";
|
|
|
|
$url = "https://{$this->config['bucket']}.cos.{$this->config['cosRegion']}.myqcloud.com{$filePath}";
|
|
|
|
// 打开文件流
|
|
|
|
$filePathUrl = config('filesystems.disks.upload')['root'].$path.'/'.$fileName;
|
|
|
|
return $this->http_put($url,$contentType,$authorization,$date,$filePathUrl);
|
|
...
|
...
|
@@ -128,8 +129,6 @@ class TencentCosService extends BaseService |
|
|
|
curl_close($ch);
|
|
|
|
// 检查响应结果
|
|
|
|
if ($response) {
|
|
|
|
var_dump($response);
|
|
|
|
die();
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
...
|
...
|
|