其他分享
首页 > 其他分享> > 微信接口配置

微信接口配置

作者:互联网

 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 }

 

标签:nonce,function,GET,微信,tmpArr,配置,接口,echostr,tmpStr
来源: https://www.cnblogs.com/cxyu/p/16023169.html