ThinkPHP开发 appId.'secret='.$this-appSecret; $jsonInfo = $this-http_curl($url); $access_token = $jsonInfo['access_token']; return $access_token; } /** * [getUserBaseInfo 获取关注者基本信息] * @param [type] $openId [此账号下的
appId.'&secret='.$this->appSecret;
$jsonInfo = $this->http_curl($url);
$access_token = $jsonInfo['access_token'];
return $access_token;
}
/**
* [getUserBaseInfo 获取关注者基本信息]
* @param [type] $openId [此账号下的用户openid]
* @return [type] [返回用户基本信息]
*/
public function getUserBaseInfo($openId)
{
$access_token = $this->getAccessToken();
$url = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token='.$access_token.'&openid='.$openId.'&lang=zh_CN';
$jsonInfo = $this->http_curl($url);
// var_dump($jsonInfo);
return $jsonInfo;
}
public function http_curl($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
$jsonInfo = json_decode($output, true);
return $jsonInfo;
}
}
