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

调式移动微信登录

... ... @@ -405,12 +405,12 @@ class LoginController extends HomeBaseController
//第三方微信移动端网页登录
public function wx_login_mobile(){
$code = $this->request->get('code');
var_dump($code);exit;
$url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid='.$this->appkey1.'&secret='.$this->appsecret1.'&code='.$code.'&grant_type=authorization_code';
// $code = $this->request->get('code');
$code = '021XhRZZ1QOdAS0AqPYZ1IGNZZ1XhRZt';//测试过期code
$url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid='.$this->appkey3.'&secret='.$this->appsecret3.'&code='.$code.'&grant_type=authorization_code';
$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');
... ...