<?php
//jsapipara
$jsapipara=array(); $jsapipara['appid']=WECHAT_APPID;
$jsapipara['noncestr']=create_rand(16);
$jsapipara['timestamp']=CLIENT_TIME; $str=array(); $str[0]='noncestr='.$jsapipara['noncestr'];
$str[1]='jsapi_ticket='.WECHAT_JSAPI_TICKET;
$str[2]='timestamp='.$jsapipara['timestamp'];
$str[3]='url='.format_url(get_current_url()); sort($str, SORT_STRING); $jsapipara['signature']=sha1(implode('&',$str)); print_r($jsapipara);
?>

《10天学会phpWeChat》系列教程传送门:

 
05-11 22:22