- 首先要确定你填写的URL在外网可以访问,填写的URL精确到你要上传的那个文件名,如我的:http://www.域名/weixin/index.php
- 将下面的代码写到index.php里面
1 //1.将timestamp,nonce,toke按字典顺序排序 2 $timestamp = $_GET['timestamp']; 3 $nonce = $_GET['nonce']; 4 $token = 'weixin'; 5 $signature = $_GET['signature']; 6 $array = array($timestamp,$nonce,$token); 7 //2.将排序后的三个参数拼接之后用sha1加密 8 $tmpstr = implode('',$array); 9 $tmpstr = sha1($tmpstr); 10 //3.将加密后的字符串与signature进行对比,判断该请求是否来自微信 11 if($tmpstr == $signature){ 12 header('content-type:text'); 13 echo $_GET['echostr']; 14 exit; 15 }
3.在网页浏览http://www.域名/weixin/index.php<什么都不会输出,不要着急>
4.在你修改配置的页面再次点击提交按钮,就会显示提交成功。<多试几次,有的时候可能是网络原因>
修改配置的时候提示token验证失败/微信公众号
猜你喜欢
转载自www.cnblogs.com/mr7664/p/10046773.html
今日推荐
周排行