请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

wxLogin返回结果false

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结果。

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

求解。

正在回答 回答被采纳积分+3

2回答

慕婉清3208872 2022-03-29 14:07:57

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

0 回复 有任何疑惑可以回复我~
7七月 2017-07-13 20:43:58

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

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号