PHP實現(xiàn)微信公眾平臺開發(fā)—基礎篇問題地址:http://idcbgp.cn/qadetail/216153 <?php
//1.將timestamp,nonce,toke按字典順序排序
$timestamp?=?$_GET['timestamp'];
$nonce?=?$_GET['nonce'];
$token?=?'zhangjun';
$signature?=?$_GET['signature'];
$array?=?array($timestamp,$nonce,$token);
//2.將排序后的三個參數(shù)拼接之后用sha1加密
$tmpstr?=?implode('',$array);
$tmpstr?=?sha1($tmpstr);
//3.將加密后的字符串與signature進行對比,判斷該請求是否來自微信
if($tmpstr?==?$signature){
????header('content-type:text');
????echo?$_GET['echostr'];
????exit;
}else{
????echo?123;
}輸出:123經(jīng)過檢查發(fā)現(xiàn)$_GET不到值!?。?
微信公眾平臺開發(fā),$_GET不到值
qq_生活是一種態(tài)度_03951778
2017-05-10 10:50:32