在保证url和token正确的情况下;
1,编码问题,用notepad打开代码保存utf-8无bom格式,或者在字符串输出前用header()设置编码;
2,关闭debug,在tp单入口文件里设置;
3,清除缓存ob_clean();
4,清除token常量两边的空白,trim(TOKEN);
5,不要频繁的请求,隔几秒再试吧;
6,实在不行的话,直接输出echo $_GET['echostr'];
在保证url和token正确的情况下;
1,编码问题,用notepad打开代码保存utf-8无bom格式,或者在字符串输出前用header()设置编码;
2,关闭debug,在tp单入口文件里设置;
3,清除缓存ob_clean();
4,清除token常量两边的空白,trim(TOKEN);
5,不要频繁的请求,隔几秒再试吧;
6,实在不行的话,直接输出echo $_GET['echostr'];
//微信验证token
public function settoken(){
$timestamp=$_GET['timestamp'];
$nonce=$_GET['nonce'];
$token='weixin'; //token
$signature=$_GET['signature'];
$array=array($timestamp,$nonce,$token);
sort($array);
$tmpstr=implode('',$array);
$tmpstr=sha1($tmpstr);
echo $_GET['echostr'];
if($tmpstr==$signature){
echo $_GET['echostr'];
exit;
}
}