其实一般报这个错误的原因大多就是验证的函数写错了
官网给的示例
private function checkSignature() { $signature = $_GET["signature"]; $timestamp = $_GET["timestamp"]; $nonce = $_GET["nonce"]; $token = 'liqingbo'; $tmpArr = array($token, $timestamp, $nonce); sort($tmpArr, SORT_STRING); $tmpStr = implode( $tmpArr ); $tmpStr = sha1( $tmpStr ); if ($tmpStr == $signature ) { return true; } else { return false; } }
其实还需要些一个函数
public function valid() { $echoStr = $_GET["echostr"]; //valid signature , option if($this->checkSignature()){ echo $echoStr; exit; } }
地址URL(服务器地址)
我以为的:域名/函数地址(checkSignature)
其实是:域名/函数地址(valid)
OK了