按照官网的一直token验证失败
在echo $_GET["echostr"];前加上header('content-type:text');这一句 就验证成功了。
const TOKEN = 'anbaojia';
function checkSignature()
{
$signature = $_GET["signature"];
$timestamp = $_GET["timestamp"];
$nonce = $_GET["nonce"];
$token = self::TOKEN;
$tmpArr = array($token, $timestamp, $nonce);
sort($tmpArr, SORT_STRING);
$tmpStr = implode( $tmpArr );
$tmpStr = sha1( $tmpStr );
if( $tmpStr == $signature ){
header('content-type:text');
echo $_GET["echostr"];
}else{
return false;
}
}