//获取tokenString result1 = HttpTool.get("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+Constant.NATIVE_APP_ID+"&secret="+Constant.NATIVE_APP_SECRET);String access_token = JSONObject.parseObject(result1).getString("access_token");if(CheckTool.isString(access_token)) { Map<String, Object> params = new HashMap<>(); params.put("scene", "test"); params.put("page", "pages/index/index"); params.put("width", 430); //这里result看上去是一个文件二进制流,直接输出是乱码 String result = HttpTool.post2("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="+access_token, params); try { System.out.println(result); //将返回的数据保存到本地 File targetFile = new File("D:\\"); if(!targetFile.exists()){ targetFile.mkdirs(); } FileOutputStream out = new FileOutputStream("D:\\upload\\3.png"); out.write(result.getBytes()); out.flush(); out.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }} else { System.out.println("获取access_token错误");} |
生成的图片文件无法打开,请问我应该如何将返回的数据保存到本地呢?

微信小程序写的真垃圾,我也遇到了这个问题
同求
您好,请问你解决了吗?请问是怎么处理的?
管理员能看下公众平台功能里没有服务直达区的问题吗? 已经收到内测通知了
我不会后端。不太懂那个。
请问你是怎么生成的呢?感谢
。。。。我们这里偶现生成的码 是空白,偶尔又可以