<?PHP //1、将timestamp,nonce,token 按字典序排序 $timestamp = $_GET['timestamp']; $nonce = $_GET['nonce'$token = 'weixin'; 你在公众平台上填写的token $signature = $_GET['signature'$arr = array( $timestamp,$nonce,1)">$token ); sort($arr); 2、将排序后的3个参数拼接后用sha1加密 $tmpstr = implode('',1)">); sha1($tmpstr3、将加密后的字符串与signature进行对比,判断该请求是否来自微信 if($tmpstr == $signature){ echo $_GET['echostr']; exit; }