https://cloud.tencent.com/developer/article/1449263
这一节看怎么用PHP实现上一节的功能
关掉上一节的
学了这么久,忘了告诉大家怎么关闭程序了.....
可以这样,建一个后缀名为.bat的文件 文件名字随意
里面写上
taskkill /IM python.exe /F
然后双击运行
会看到这边断开了
其它方式自行百度
咱把程序放到这里面
里面建一个token.php 的文件
<?php
//http://localhost:63343/lesson2/lesson2.php?timestamp=1&nonce=2&signature=3
//1. 将timestamp , nonce , token 按照字典排序
$timestamp = $_GET['timestamp'];
$nonce = $_GET['nonce'];
$token = "mnifdv";
$signature = $_GET['signature'];
$array = array($timestamp, $nonce, $token);
sort($array);
//2.将排序后的三个参数拼接后用sha1加密
$tmpstr = implode('', $array);
$tmpstr = sha1($tmpstr);
//3. 将加密后的字符串与 signature 进行对比, 判断该请求是否来自微信
if ($tmpstr == $signature) {
header('content-type:text');
echo $_GET['echostr'];
exit;
}
else {
echo "";
}
网上还有其它人用TCP实现解析的...其实都一样,如果学习了前面的教程应该懂得 ....