secret_id = $secret_id; $this->secret_key = $secret_key; } /** * 客户端上传签名 * 官网文档地址:https://cloud.tencent.com/document/product/266/9221 * @return string */ public function getUploadSign() { // 向参数列表填入参数 $arg_list = [ "secretId" => $this->secret_id, "currentTimeStamp" => time(), "expireTime" => time() + 86400, // 签名有效期:1天 "random" => rand() ]; // 计算签名 $orignal = http_build_query($arg_list); $signature = base64_encode(hash_hmac('SHA1', $orignal, $this->secret_key, true).$orignal); return ResultWrapper::success($signature); } }