标签:
$wechat_accesstoken = $wechat_domain."oauth2/access_token?appid=".APPID."&secret=".SECRET."&code=".$code."&grant_type=authorization_code"; $r = httpsget($wechat_accesstoken); $a = json_decode($r,true); $accesstoken = $a[‘access_token‘]; //$refresh_token = $a[‘refresh_token‘]; $openid = $a[‘openid‘]; //拉取用户信息 $wechat_user = $wechat_domain."userinfo?access_token=".$accesstoken."&openid=".$openid."&lang=zh_CN"; $r = httpsget($wechat_user); $a = json_decode($r,true);
//a 的内容如下 $a = array( ‘nickname‘=>$a[‘nickname‘], ‘sex‘=>$a[‘sex‘], ‘province‘=>$a[‘province‘], ‘city‘=>$a[‘city‘], ‘country‘=>$a[‘country‘], ‘headimgurl‘=>$a[‘headimgurl‘], ‘privilege‘=>json_encode($a[‘privilege‘]), ‘unionid‘=>$a[‘unionid‘] );
标签:
原文地址:http://www.cnblogs.com/xueyuwyz/p/4241862.html