Beispiel #1
0
 public function getinfo()
 {
     $keysArr = array("source" => $this->config['appkey'], "user_id" => $this->open_id, "format" => 'json');
     $response = $this->get(self::GET_INFO_URL, $keysArr);
     $info = json_decode($response, true);
     if (isset($info['eror'])) {
         return false;
     }
     $this->nickname = $info['screen_name'];
     $this->avatar = $info['profile_image_url'];
     return parent::getUserInfo();
 }
Beispiel #2
0
 public function getUserInfo()
 {
     $keysArr = array("access_token" => $this->access_token, "oauth_consumer_key" => $this->config['appid'], "openid" => $this->open_id, "format" => 'json');
     $response = $this->get(self::GET_INFO_URL, $keysArr);
     $body = $response->getBody();
     $info = json_decode($body, true);
     if ($info['ret'] > 0) {
         return false;
     }
     //输出错误信息
     $this->nickname = $info['nickname'];
     $this->avatar = empty($info['figureurl_qq_2']) ? $info['figureurl_qq_1'] : $info['figureurl_qq_2'];
     return parent::getUserInfo();
 }