微信公众测试号php配置失败,微信测试号的接口配置信息--配置失败

问题:微信测试号的接入问题

接入一直提示配置失败

//这个是成功图

411b386813b8

image.png

debug思路:

查看apache日志,error.log

411b386813b8

image.png

没找到错误。

配置输出跟踪中间量

这里我写了一个类

/**

* Created by PhpStorm.

* User: sirius

* Date: 2017/10/7

* Time: 9:32

*/

class LogUtil

{

private $filePath;

public function __construct($filePath='log.ss')

{

date_default_timezone_set('PRC');

$this->filePath=$filePath;

}

public function pushError($msg){

$today = date("[Y-m-d H:i:s]");

$content=$today."-[error]:\t".$msg.PHP_EOL;

file_put_contents($this->filePath,$content,FILE_APPEND);

}

public function pushNotice($msg){

$today = date("[Y-m-d H:i:s]");

$content=$today."-[notice]:\t".$msg.PHP_EOL;

file_put_contents($this->filePath,$content,FILE_APPEND);

}

public function pushDebug($msg){

$today = date("[Y-m-d H:i:s]");

$content="$today-[debug]:\t$msg".PHP_EOL;

file_put_contents($this->filePath,$content,FILE_APPEND);

}

}

在程序中输出验证过程需要的一些变量值

411b386813b8

image.png

这里str是用sha1加密处理的结果,显然和signature相等

查看源代码

模拟访问:查看access.log

每一次的提交,微信服务器都会对我们的服务器来一次验证性的访问,所以看访问apache的日志:access.log

411b386813b8

image.png

可以看到

411b386813b8

image.png

然后复制访问地址,拼接上域名,用浏览器访问

发现echostr可以显示出来

411b386813b8

image.png

浏览器右键查看源码

发现多了一行空行,然后才是数据,后来发现我php代码<?php前多了一个空行

正确的结果

411b386813b8

image.png

只有一行,一行,切记

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值