1-微信开发接口配置

class Wechat
{
public function __construct(){
    $this->checkSignature();
}

private function checkSignature()
{
    $signature = $_GET["signature"]; // 加密签名 微信服务器
    $timestamp = $_GET["timestamp"]; // 时间戳
    $nonce = $_GET["nonce"]; // 随机数
    $echostr = $_GET['echostr'];

    $token = 'zhangxuhui';
    $tmpArr = array($token, $timestamp, $nonce);
    sort($tmpArr, SORT_STRING);
    $tmpStr = implode( $tmpArr );
    $tmpStr = sha1( $tmpStr );

    if( $tmpStr == $signature ){
        echo $echostr;
    }else{
        return false;
    }
}

public function index(){

}
}
posted @ 2022-03-24 15:23  陌生人的天宇  阅读(22)  评论(0)    收藏  举报