微信接口配置

复制代码
 1 class Wechat
 2 {
 3     public function __construct(){
 4         $this->checkSignature();
 5     }
 6 
 7     private function checkSignature()
 8     {
 9         $signature = $_GET["signature"]; // 加密签名 微信服务器
10         $timestamp = $_GET["timestamp"]; // 时间戳
11         $nonce = $_GET["nonce"]; // 随机数
12         $echostr = $_GET['echostr'];
13 
14         $token = 'zhangxuhui';
15         $tmpArr = array($token, $timestamp, $nonce);
16         sort($tmpArr, SORT_STRING);
17         $tmpStr = implode( $tmpArr );
18         $tmpStr = sha1( $tmpStr );
19 
20         if( $tmpStr == $signature ){
21             echo $echostr;
22         }else{
23             return false;
24         }
25     }
26 
27     public function index(){
28 
29     }
30 }
复制代码

 

posted @   被水遗忘の鱼  阅读(122)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示