如何解决php weixin 配置失败问题
本文操作环境:Windows7系统,php7.4版,Dell G3电脑。
如何解决php weixin 配置失败问题?
php 微信公众号开发校验token 提示配置失败
<?php // //最简单的验证方式 // echo $_GET["echostr"]; //验证是否来自于微信 function checkWeixin() { //微信会发送4个参数到我们的服务器后台 签名 时间戳 随机字符串 随机数 $signature = $_GET["signature"]; $timestamp = $_GET["timestamp"]; $nonce = $_GET["nonce"]; $echostr = $_GET["echostr"]; $token = "zchare861230"; // 1、将token、timestamp、nonce三个参数进行字典序排序 $tmpArr = array($nonce,$token,$timestamp); sort($tmpArr,SORT_STRING); // 2、将三个参数字符串拼接成一个字符串进行sha1加密 $str = implode($tmpArr); $sign = sha1($str); // 3、开发者获得加密后的字符串可与signature对比,标识该请求来源于微信 if ($sign == $signature) { echo $echostr; } } checkWeixin(); ?>
版权声明:
作者:后浪云
链接:https://www.idc.net/help/8189/
文章版权归作者所有,未经允许请勿转载。
THE END