收藏
回答

access_token 怎么获取

问题类型 插件 AppID 插件版本号 AppID 操作系统 微信版本 基础库版本
需求 wx2b03c6e691cd7370 1.0 wx78ba77fefdec0ccc iOS 7.0.10 2.8.3

请求接口需要传access_token,想问下怎么获取

回答关注问题邀请回答
收藏

2 个回答

  • 星星点灯
    星星点灯
    2020-02-25
    //获取AccessToken
      function getAccessToken(){
        $appid="你的appid";
        $appsecret = "你的appsecret";
        //文件存储
        $data=json_decode(get_php_file("access_token.php"));
        if($data->expire_time<time()){
          $url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$appsecret;
          $res=json_decode(httpGet($url));
          $access_token=$res->access_token;
          if($access_token){
            $data->expire_time=time()+7000;
            $data->access_token=$access_token;
            set_php_file("access_token.php",json_encode($data));
          }
        }else{
          $access_token=$data->access_token;
        }
        return $access_token;
      }
    
    
    
    2020-02-25
    有用 1
    回复
  • 🔥燚燚燚燚🔥
    🔥燚燚燚燚🔥
    2020-02-25
    如果是第三方开发平台是不是,没有办法获取到roomid,好像第三方平台access_token无效
    

    。第三方平台的获取roomid什么时候支持啊?

    2020-02-25
    有用
    回复
登录 后发表内容
问题标签