zoukankan      html  css  js  c++  java
  • 服务号获取已关注用户的基本信息

    /*
         * 获取token
         */
        private function get_access_token(){
            $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$this->appleid}&secret={$this->secret}";
            $str = file_get_contents($url);
            $arr = json_decode($str,true);
            if(isset($arr['access_token']) && $arr['access_token'] != ''){
                return $arr['access_token'];
            }else{
                return '';
            }
        }
    
        /*
         * 获取用户信息
         */
        private function user_info($openid){
            $token = $this->get_access_token();
            $url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={$token}&openid={$openid}&lang=zh_CN";
            $str = file_get_contents($url);
            $arr = json_decode($str,true);
            return $arr;
        }
    

     参考:https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140183

        https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839

  • 相关阅读:
    xml转json
    3DES双倍长加密
    数据的集合运算
    SQL:1999基本语法
    表的连接操作
    数据库的连接
    表空间的创建
    用户的创建
    通用函数
    转换函数
  • 原文地址:https://www.cnblogs.com/mr-amazing/p/9835556.html
Copyright © 2011-2022 走看看