驗證token失敗
<?php
//1.將timestamp,nonce,token按字典序排序
? ? ? $timestamp ? =$_GET['timestamp'];
? ? ? ? ? $nonce ? =$_GET['nonce'];
?$token ? ='weixin';
? ? ?$signature ? ?=$_GET['signature'];
$array ? ? ? ?=array($timestamp,$nonce,$token);
sort($array);
//2.將排序后的三個參數(shù)拼接之后用shal加密
? ? $tmpstr ? ? ? ?=implode('',$array);//jojn
$tmpstr ? ? ? ? =shal($tmpstr);
//3.將加密后的字符串與signature進行對比,判斷請求是否來自微信
? ? ? ? ? ?if($tmpstr==$signature){
? echo ?$_GET['echostr];
? exit
? }
//驗證token失敗,微信token,weixin寫的和代碼里的一樣,問題就不知在那里
2015-10-28
sort($array,SORT_STRING);
加呢后說參數(shù)錯誤
2015-10-25
我也遇到這個問題了! 不知道咋回事!