作者 lyh

gx

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