作者 景龙
1 个管道 的构建 通过 耗费 0 秒

调试微信移动登录

... ... @@ -416,7 +416,17 @@ class LoginController extends HomeBaseController
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.$this->appkey2.'&secret='.$this->appsecret2;
$res = $this->http_get($url);
$json_arr = json_decode($res,true);
var_dump($json_arr);exit;
if(!isset($json_arr['access_token'])&&empty($json_arr['access_token'])){
//用户取消登录
$this->redirect('/portal/login/thirdLogin');
}
$token = $json_arr['access_token'];
$openid = 'oYOYl5hbULoKimG5R8Uk-Paha0d8';
//通过access_token获取用户信息
$url1 = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token='.$token.'&openid='.$openid.'&lang=zh_CN';
$res1 = $this->http_get($url1);
$info = json_decode($res1,true);
var_dump($info);exit;
}
//第三方微博登录
... ...