<php
//1.获取参数
$timestamp = $_GET['timestamp'];
$nonce = $_GET['nonce'];
$token = 'weixin';//token必须与官网配置一致
$signature = $_GET['signature'];
//2.拼接,排序,加密参数
$array = array($timestamp,$nonce,$token);
sort($array);
$tmpstr = implode('',$array);
$tmpstr = sha1($tmpstr);
//3.验证参数
if ($tmpstr == $signature){
echo $_GET['echostr'];
exit;
}
?>
网友评论