前面的步骤都可以按照官方文档的来,我的问题出在了获取access_token..

记一次php获取微信用户

 

我一直在纠结如何取到这个access_token,用ajax一直都取不到,可能是微信为了安全。

后来运用了这个就取到了

  $weixin=file_get_contents("https://api.weixin.qq.com/sns/oauth2/access_token?appid=xxxxxxxxx&secret=xxxxxxxxx&code=".$code."&grant_type=authorization_code");
        $jsondecode=json_decode($weixin);
        $array=get_object_vars($jsondecode);
        $access_token=$array['access_token'];
        $openid=$array['openid'];

 

相关文章:

  • 2021-06-02
  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
  • 2021-07-20
  • 2022-12-23
  • 2021-11-25
猜你喜欢
  • 2022-01-21
  • 2022-01-26
  • 2021-04-16
  • 2021-11-24
  • 2022-01-18
  • 2022-12-23
相关资源
相似解决方案