LaneWeChat\Core\Wechat::__construct PHP Method

__construct() public method

初始化,判断此次请求是否为验证请求,并以数组形式保存
public __construct ( string $token, boolean $debug = FALSE )
$token string 验证信息
$debug boolean 调试模式,默认为关闭
    public function __construct($token, $debug = FALSE)
    {
        //未通过消息真假性验证
        if ($this->isValid() && $this->validateSignature($token)) {
            return $_GET['echostr'];
        }
        //是否打印错误报告
        $this->debug = $debug;
        //接受并解析微信中心POST发送XML数据
        $xml = (array) simplexml_load_string(file_get_contents('php://input'), 'SimpleXMLElement', LIBXML_NOCDATA);
        //将数组键名转换为小写
        $this->request = array_change_key_case($xml, CASE_LOWER);
    }