前言
话不多说,我是看了这些文章解决的
https://github.com/sbzhu/weworkapi_php
https://work.weixin.qq.com/api/doc#10514
https://work.weixin.qq.com/api/doc#90000/90139/90968/验证URL函数
https://blog.csdn.net/nvzizhou/article/details/52248616
正文
下载我的包:https://download.csdn.net/download/deaidai/11302743
代码结构
到时候让请求访问落到index.php。
我这里用nginx,可以参考我的部分配置
if ( $request_uri ~ ^/wechat/callback ) {
rewrite ^/wechat/callback(.*)$ /wechat/callback/index.php$1 last;
}
https://你的网站/wechat/callback为回调消息地址
然后,注意编解码问题,在php里设置
header("Content-Type:text/html; charset=utf-8");
header('content-type:text');