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-01-06 09:56  公子初心  阅读(110)  评论(0编辑  收藏  举报