/** * @return bool */ public function setUuid() { $param = array('appid' => 'wx782c26e4c19acffb', 'fun' => 'new', 'lang' => 'zh_CN', '_' => time()); $responseData = Requests::post('https://login.weixin.qq.com/jslogin', null, $param); $body = $responseData->body; preg_match_all('/window.QRLogin.code = (\\d+); window.QRLogin.uuid = "(\\S+?)"/', $body, $array); //status code $statusCode = $array[1][0]; $uuid = $array[2][0]; if ($statusCode == 200) { self::$uuid = $uuid; return true; } return false; }