資源簡介
JAVA代碼,解決微信掃描APK二維碼空白,不能下載APP的問題
代碼片段和文件信息
package?XXXX;
//解決微信掃描APK二維碼空白,不能下載APP的問題
//基于SpringBoot框架轉換二維碼時先在url后加#mp.weixin.qq.com
@RestController
@RequestMapping(“/getApp“)
public?class?getAPP?{
?@GetMapping
?public?void?getAPP(@RequestParam(name?=?“fileName“)?String?fileName?HttpServletResponse?response)?throws?ServletException?IOException?{
????response.setCharacterEncoding(“UTF-8“);
????String?aFileName?=?new?String(fileName.getBytes(“iso8859-1“)?“UTF-8“);
????????File?fileLoad?=?new?File(“服務器物理文件地址“?aFileName);
????????FileInputStream?in?=?null;
????????OutputStream?out?=?response.getOutputStream();
????????byte[]?b?=?new?byte[1024];
????????try?{
????????????response.setHeader(“Content-disposition“
????????????????????“attachment;?filename=“?+?new?String(aFileName.getBytes(“UTF-8“)?“ISO-8859-
評論
共有 條評論