收藏
回答

【智商是硬伤】获取小程序二维码流是多少进制的(二进制,八进制)?

问题模块
API和组件

为啥不给二维码服务器图片地址啊

//

function getToken(){

var loadurl="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+

getApp().data.appkey.appid+"&secret="+getApp().data.appkey.secret; 

wx.request({ url: loadurl,method: 'POST',

 header: {'content-type': 'application/x-www-form-urlencoded'},  

   data: {  }

 ,success: function (res) { 

    var access_token=res.data.access_token; console.log(access_token);

    getCode(access_token);

   }

});

}


function getCode(access_token){

var loadurl="https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token="+access_token; 

wx.request({ url: loadurl,method: 'POST',

 //header: {'content-type': 'application/x-www-form-urlencoded'},  

 data: {

 "path":"pag/index/index",

 "width":200,

 },success: function (res) {//图片 二进制流 

 pag.setData({img_code:res.data });

    console.log("图片"+res.data.length);

   

    //for(var p in res.data){  console.log(p + " " + res.data[p]); }

   }

});

}



最后一次编辑于  2017-06-09  (未经腾讯允许,不得转载)
邀请回答
复制链接收藏关注问题回答

3 个回答

  • 影楼云选片 2019跨平台在线选片
    影楼云选片 2019跨平台在线选片
    2017-06-09

    参考我回答的另一帖子

    2017-06-09
    赞同
    回复
  • 小益
    小益
    2017-06-21

    靠我的是JAVA

    2017-06-21
    赞同
    回复
  • 小益
    小益
    2017-06-21

    为啥JAVA得不到图片流咯,在微信模拟器里面可以的

    URL address=new URL(url);  

    HttpURLConnection uc=(HttpURLConnection)address.openConnection();

    uc.setRequestProperty("Connection", "keep-alive");

    uc.setRequestProperty("Accept", "*/*");

    uc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");

    uc.setRequestProperty("Host", "api.mch.weixin.qq.com");

    uc.setRequestProperty("X-Requested-With", "XMLHttpRequest");

    uc.setRequestProperty("Cache-Control", "max-age=0");

    uc.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) ");

    uc.setRequestMethod("POST"); 

    uc.setDoOutput(true); 

    OutputStream os = uc.getOutputStream(); 

    os.write(where.getBytes());  // &password=admin

    os.close();  

    uc.connect(); 

    InputStream inputStream=uc.getInputStream();

    InputStreamReader inputStreamReader=new InputStreamReader(inputStream,"utf8");

    BufferedReader news=new   BufferedReader(inputStreamReader);

    String  line=news.readLine();

    while (line!=null)   { 

    result+=line; line=news.readLine(); 

    news.close();

    inputStreamReader.close();

    inputStream.close();


    2017-06-21
    赞同
    回复