解决方法:查看控制器引用的header文件,是否包含空格,如下: header('Content - Type : application / force-download'); header ('Content-Type:application/force-download'); (一定切记用半角) 四.切记runtime的目录一定可读可写可执行,不然程序执行不了,肯定报错
header("Cache-Control:must-revalidate, post-check=0, pre-check=0"); header("Content-Type:application/force-download header("Cache-Control:must-revalidate, post-check=0, pre-check=0"); header("Content-Type:application/force-download
Access-Control-Expose-Headers", "Content-Disposition"); // 清空输出流 response.setContentType("application/force-download
// IE version var blob = new Blob([req.response], {type: 'application/force-download Firefox version var file = new File([req.response], filename, {type: 'application/force-download
// IE version var blob = new Blob([req.response], {type: 'application/force-download Firefox version var file = new File([req.response], filename, {type: 'application/force-download
} $outfile = "数据列表.xls"; ob_end_clean(); header("Content-Type: application/force-download
outputStream = response.getOutputStream(); response.setContentType(“application/force-download
ZipUtil.zip(targetName); targetName = targetName+".zip"; response.setContentType("application/force-download
MKOnlineMusicPlayer 的时候就遇到了类似的问题:为了实现音乐直接点击下载而不是在浏览器中打开,我的做法是用 PHP 在后台读取音乐文件,再加上 Content-Type: application/force-download
Cache-Control:must-revalidate, post-check=0, pre-check=0"); header("Content-Type:application/force-download
doc.write(fos); // 设置强制下载不打开 response.setContentType("application/force-download
withHeader('content-description', 'File Transfer') ->withHeader('content-type', 'application/force-download
if (file.exists()) { // 设置强制下载打开 response.setContentType("application/force-download
withHeader('content-description', 'File Transfer') ->withHeader('content-type', 'application/force-download
, fileName); if (file.exists()) { response.setContentType("application/force-download
, fileName); if (file.exists()) { response.setContentType("application/force-download
getActiveSheet()->setTitle($excelTitle); //设置浏览器窗口下载表格 header("Content-Type: application/force-download
header("Cache-Control;must-revalidate, post-check=0, pre-check=0″); header("Content-Type;application/force-download
(”Cache-Control: must-revalidate, post-check=0, pre-check=0″); header(”Content-Type: application/force-download
FileInputStream fis = new FileInputStream(file); // 设置相关格式 response.setContentType("application/force-download