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(){

    }
}

本文来自博客园,作者:公子初心,转载请注明原文链接:https://www.cnblogs.com/itzhangxuhui/p/15769832.html

原文地址:https://www.cnblogs.com/itzhangxuhui/p/15769832.html