public function getBaseInfo() { $app_id = 'wxe103b4f7bbaeb1c6'; //公众号appid $redirect_uri = urlencode("http://whltest.applinzi.com/www/wechat/public/index.php/index/index/access_token_info"); $url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$app_id."&redirect_uri=".$redirect_uri."&response_type=code&scope=snsapi_userinfo &state=123#wechat_redirect"; header('Location:'.$url);exit; }public function access_token_info(){$app_id = 'wxe103b4f7bbaeb1c6';$app_secret = '7212da94e0a385b08c5de46ffef61740';$code = $GET['code'];$url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=".$app_id."&secret=".$app_secret."&code=".$code."&grant_type=authorization_code";$res = $this->http_curl($url);var_dump($res);$access_token = $res['access_token'];$openid = $res['openid'];$url = "https://api.weixin.qq.com/sns/userinfo?access_token=".$access_token."&openid=".$openid."&lang=zh_CN";$res = $this->http_curl($url);var_dump($res);}
目前暂无任何回答
- 0 回答
- 0 关注
- 1959 浏览
添加回答
举报
0/150
提交
取消