Signature 阿里云签名值获取方法
Posted makeinchina
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Signature 阿里云签名值获取方法相关的知识,希望对你有一定的参考价值。
<?php function CreateUploadVideo(){ $a=‘LT*****Q8‘; $ck=‘hEro****vqPbj‘; $h_8_time = time() - 8*60*60; $get_key = array(‘Format‘,‘Version‘,‘AccessKeyId‘,‘SignatureMethod‘,‘Timestamp‘,‘SignatureNonce‘,‘SignatureVersion‘,‘Action‘,‘Title‘,‘FileName‘); $get_key_value = array(‘Format‘ => ‘JSON‘,‘Version‘ => ‘2017-03-21‘,‘SignatureMethod‘ => ‘HMAC-SHA1‘,‘SignatureNonce‘ => time() + rand(50000,100000),‘SignatureVersion‘ => ‘1.0‘,‘AccessKeyId‘ => $a,‘Timestamp‘ => date(‘Y-m-d‘,$h_8_time).‘T‘.date(‘H:i:s‘,$h_8_time).‘Z‘,‘Action‘ => ‘CreateUploadVideo‘,‘Title‘ => ‘PHP_Demo_signature‘,‘FileName‘=>‘config.mp4‘); sort($get_key); $StringToSign = ‘GET&‘.urlencode(‘/‘).‘&‘; $q_str = ‘‘; foreach($get_key as $kval){ $q_str .= urlencode($kval).‘=‘.urlencode($get_key_value[$kval]).‘&‘; } //echo $q_str." "; $q_str = substr($q_str,0,-1); //echo $q_str." "; $StringToSign .= urlencode($q_str); //echo $StringToSign." "; $ok_url = ‘http://vod.cn-shanghai.aliyuncs.com?‘.$q_str.‘&Signature=‘.urlencode(base64_encode(hash_hmac("sha1",$StringToSign,$ck.‘&‘,true))); //sha1($StringToSign,true) echo $ok_url." "; } CreateUploadVideo(); ?>
以上是关于Signature 阿里云签名值获取方法的主要内容,如果未能解决你的问题,请参考以下文章
微信JS-SDK获取signature签名以及config配置