作者 lyh

gx

... ... @@ -44,15 +44,18 @@ class TencentCosService extends BaseService
// 构造请求方法、URL和头部
$url = 'https://' . $this->config['bucket'] . '.cos.' . $this->config['cosRegion'] . '.myqcloud.com'.$path;
var_dump($url);
die();
$this->method = 'PUT';
$headers = array(
'Authorization: ' . $this->cosAuthorization($this->config['appId'], $this->config['secretId'], $this->config['secretKey'], $this->method, '/' . $this->config['bucket'] . $path),
'Content-Type: image/'.$image_type // 根据上传的文件类型设置相应的Content-Type
);
var_dump($headers);
// 打开文件流
$url_path = config('filesystems.disks.upload')['root'].$path;
var_dump($url_path);
$file = fopen($url_path, 'r');
var_dump($file);
die();
return $this->http_put($url,$headers,$file,$url_path);
}
... ...