wxLogin返回结果false

来源:9-8 API小程序测试工具

慕娘2533839

2017-07-13

function __construct($code){
   $this->code = $code;
   $this->wxAppID = config('wx.app_id');
   $this->wxAppSecret = config('wx.app_secret');
   $this->wxLoginUrl = sprintf(
       config('wx.login_url'), $this->wxAppID, $this->wxAppSecret, $this->code);
}
public function get(){
   $result = curl_get($this->wxLoginUrl);
   $wxResult = json_decode($result,true);
   if(empty($wxResult)){
       throw new Exception('获取openID异常,微信内部错误');
   }
   else{
       $loginFail = array_key_exists('errcode',$wxResult);
       if($loginFail){
           $this->processLoginError($wxResult);
       }
       else{
           $this->grantToken($wxResult);
       }

   }
}



调试的时候,通过断点查看能够正确获取code和appid等参数。

$result = curl_get($this->wxLoginUrl)执行后返回false结果。

但是直接在浏览器输入带参数地址,能够正确返回结果。

求解。

写回答

2回答

慕婉清3208872

2022-03-29

你好,我也是这里result返回false,请问你是怎么解决的?

0
0

7七月

2017-07-13

看一下,curl_get最直接的返回结果是什么?打个断点看一下,然后截图告诉我。

0
0

微信小程序电商实战 从前端到后端的全流程精讲

全栈工程师/前后端都讲/架构思想/ RESTFul API、MySQL表设计

4856 学习 · 4388 问题

查看课程