$appID = 'wxd281df297a6dc834';
$appsecret = '20b2deacfa8a9e88a9afcbbe12da1f31';
define('TOKEN','weixin');
function checksignature(){
$signature=isset($_GET['signature']) ? $_GET['signature'] : '';
$timestamp=isset($_GET['timestamp']) ? $_GET['timestamp'] : time();
$nonce=isset($_GET['nonce']) ? $_GET['nonce'] : '';
$dataArray=array($nonce,$timestamp,TOKEN);
sort($dataArray);
$str=implode($dataArray);
$str=sha1($str);
if($str==$signature){
//返回true 标识当前请求的确来自于微信服务器
return true;
}else{
return false;
}
}
if(checksignature()){
//返回echostr 表示当前网址介入成功 token 验证成功
$echostr=$_GET['echostr'];
if($echostr){
echo $echostr;
exit;
}
}
以上是我的index.php的内容,用的是natapp免费版,http://wxf9in.natappfree.cc 是映射的地址,直接访问没有问题,用同样的在自己的订阅号试了一下,第一次说url请求超时,第二次竟然配置成功了,但是放在测试号一直提示配置失败,也不知道原因在哪,求大神指点!或者有没有什么办法可以知道配置失败的具体原因是什么?