本签名示例代码仅供参考,请根据实际情况使用。
PHP 示例代码
<?php
$secretKey = 'xxxxx';
$srcStr = 'POSTdsa.api.qcloud.com/v2/index.php?';
$param = [
"Action"=>"UpdateDsaHostInfo",
"Nonce"=>rand(),
"SecretId"=>"xxxxx",
"Timestamp"=> time(),
"https"=>json_encode(["type"=>4]),
"hostId"=>4848,
];
ksort($param); //参数排序
$srcStr .= urldecode(http_build_query($param));
echo $srcStr.PHP_EOL;
$signStr = base64_encode(hash_hmac('sha1', $srcStr, $secretKey, true));
echo $signStr;