/**
* 腾讯云PHP计算COS签名
* 2021-12-23 10:59:27
* @param $uri
* @return string
*/
public static function signCos($uri)
{
//$SecretId = "AKIDtd8NL2mqa4JK8jpBdTfkZ7Sj3slMkyfwXs";
//$SecretKey = "JK9h383vSs7IL85nMyMSKmzziBU3jhOt7c";
$SecretId = env('COSV5_SECRET_ID');
$SecretKey = env('COSV5_SECRET_KEY');
$host = env('COSV5_CDN') ?? "https://oa-123024434702.cos.ap-guangzhou.myqcloud.com";
#得到 KeyTime
$StartTimestamp = time();
$EndTimestamp = strtotime("+30 minute");
$KeyTime = "$StartTimestamp;$EndTimestamp";
#得到 signKey
$signKey = hash_hmac('sha1', $KeyTime, $SecretKey);
#得到 httpString
$httpMethod = 'get';
$httpUri = $uri;//请求路径文件
$httpParameters = '';
腾讯云COS配置了私有读写,PHP如何下载文件
最新推荐文章于 2024-08-06 09:17:20 发布