微信测试号的接口配置信息--配置失败

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

接入一直提示配置失败

//这个是成功图


微信测试号的接口配置信息--配置失败_第1张图片
image.png

debug思路:

  1. 查看apache日志,error.log
image.png

没找到错误。

  1. 配置输出跟踪中间量
    这里我写了一个类
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);

    }

}

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

微信测试号的接口配置信息--配置失败_第2张图片
image.png

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

  1. 查看源代码
    模拟访问:查看access.log
    每一次的提交,微信服务器都会对我们的服务器来一次验证性的访问,所以看访问apache的日志:access.log
微信测试号的接口配置信息--配置失败_第3张图片
image.png

可以看到

image.png

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

发现echostr可以显示出来

微信测试号的接口配置信息--配置失败_第4张图片
image.png

浏览器右键查看源码
发现多了一行空行,然后才是数据,后来发现我php代码

正确的结果

微信测试号的接口配置信息--配置失败_第5张图片
image.png

只有一行,一行,切记

你可能感兴趣的:(微信测试号的接口配置信息--配置失败)