function checkSignature($token) { $signature = !empty($_GET["signature"]) ? $_GET["signature"] : null; $timestamp = !empty($_GET["timestamp"]) ? $_GET["timestamp"] : null; $nonce = !empty($_GET["nonce"]) ? $_GET["nonce"] : null; $tmpArr = array($token, $timestamp, $nonce); sort($tmpArr, SORT_STRING); $tmpStr = implode($tmpArr); return sha1($tmpStr) == $signature; } // 微信公众后台填写的Token $token = 'itsource'; // 如果验证正确,则返回参数echostr的内容,否则终止执行 if(checkSignature($token)) { echo $_GET['echostr']; } exit();
tidak,
Tiada petua?