|
...
|
...
|
@@ -36,9 +36,16 @@ class TencentCosService extends BaseService |
|
|
|
$this->config['bucket'] = $this->cos['bucket'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :上传图片
|
|
|
|
* @name :uploadToCos
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/19 14:47
|
|
|
|
*/
|
|
|
|
public function uploadToCos($file,$path,$filename)
|
|
|
|
{
|
|
|
|
$objectKey = $path.'/',$filename;
|
|
|
|
$objectKey = $path.'/'.$filename;
|
|
|
|
// 上传到腾讯云 COS
|
|
|
|
$httpClient = new Client();
|
|
|
|
$response = $httpClient->request('PUT', "https://{$this->config['bucket']}.cos.{$this->config['cosRegion']}.myqcloud.com/{$objectKey}", [
|
|
...
|
...
|
@@ -52,6 +59,13 @@ class TencentCosService extends BaseService |
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :签名
|
|
|
|
* @name :generateHeaders
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/19 14:47
|
|
|
|
*/
|
|
|
|
private function generateHeaders($secretId, $secretKey)
|
|
|
|
{
|
|
|
|
$keyTime = time() - 1 . ';' . (time() + 300);
|
...
|
...
|
|