zoukankan      html  css  js  c++  java
  • 通过access_token openid获取微信用户昵称等信息

    <?php
    header('Access-Control-Allow-Origin:*');
    $access_token = !empty($_GET['access_token'])?$_GET['access_token']:'';
    $openid       = !empty($_GET['openid'])?$_GET['openid']:'';
    //该微信url不允许前端ajax直接访问,只能由本地后端访问获取数据,再通过ajax传给前端
    $url          = "https://api.weixin.qq.com/sns/userinfo?access_token={$access_token}&openid={$openid}&lang=zh_CN";
    //echo $url;exit;
    echo file_get_contents($url);
    
    //https://api.weixin.qq.com/sns/userinfo?access_token=8_7O0hMPhShKPeicr8DJMpAwgUklPOPJTVmXQ0X1oXeX1sjvGK1bb8kZlxz4z10LkT_PRvssrnDwEswhXtvghxmarYl3gTFrvm1DtVanZn2vlTlpZhnbBb8K7jVszfU-q17Uysrarxz6f60ooNLSUiAFACJL&openid=o5-P4snElQIi859NmTB3bZ_ryGF0&lang=zh_CN
    ?>
  • 相关阅读:
    Brupsuite 中插件CO2的使用
    记事本默认编码改为UTF-8
    Crackme031
    Crackme030
    Crackme029
    Crackme028
    Crackme026
    Crackme025
    Crackme024
    Crackme022
  • 原文地址:https://www.cnblogs.com/dreamhome/p/8878245.html
Copyright © 2011-2022 走看看