在phpWeChat中生成公众号 jssdk 各个参数(PHP)
1 <?php 2 //jsapipara 3 $jsapipara=array(); 4 5 $jsapipara['appid']=WECHAT_APPID; 6 $jsapipara['noncestr']=create_rand(16); 7 $jsapipara['timestamp']=CLIENT_TIME; 8 9 $str=array(); 10 11 $str[0]='noncestr='.$jsapipara['noncestr']; 12 $str[1]='jsapi_ticket='.WECHAT_JSAPI_TICKET; 13 $str[2]='timestamp='.$jsapipara['timestamp']; 14 $str[3]='url='.format_url(get_current_url()); 15 16 sort($str, SORT_STRING); 17 18 $jsapipara['signature']=sha1(implode('&',$str)); 19 20 print_r($jsapipara); 21 ?>