修改公众号的服务器配置
Token配置代码,文件放在对应的URL路径下
微信会发送GET请求来验证
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <?php define("TOKEN", "mrxy");
$echoStr = $_GET["echostr"]; if(checkSignature()){ echo $echoStr; exit; }
function checkSignature() { $signature = $_GET["signature"]; $timestamp = $_GET["timestamp"]; $nonce = $_GET["nonce"]; $token = TOKEN; $tmpArr = array($token, $timestamp, $nonce); sort($tmpArr, SORT_STRING); $tmpStr = implode($tmpArr); $tmpStr = sha1($tmpStr);
if($tmpStr == $signature){ return true; }else{ return false; } }
|
微信授权网页登录:https://www.cnblogs.com/whowhere/p/5787247.html
微信扫码登录:https://www.cnblogs.com/0201zcr/p/5133062.html