把$token 改成自己的填写的就行了
<?php
//1.将timestamp,nonce,token按字典序排序
$timestamp=$_GET['timestamp']; //时间戳
$nonce = $_GET['nonce']; //随机字符串
$token ='weixin';
$signature= $_GET['signature'];
$array=array($timestamp,$nonce,$token);
sort($array);//按字典顺序排序
//2.将排序后的三个参数拼接之后用sha1加密
$tmpstr=implode('',$array);//拼接
$tmpstr=sha1($tmpstr);//加密
//3.将加密后的字符串与signature进行对比,判断该请求是否来自微信
if($tmpstr==$signature){
echo $_GET['echostr'];
exit;
}