我正在尝试强制下载 PDF 文件,一切正常。唯一的问题是,当它显示“下载框”时,它说它是“Firefox 文档”,实际上应该说“Adobe Acrobat 文档”。查看图像,下面是我正在使用的代码
1)从gmail强制下载盒子,效果很好
2)从我的应用程序强制下载框,上面写着“Firefox Document”
header("Pragma: public");
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/pdf");
header("Content-Disposition: attachment; filename=\"".basename($file)."\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize(getcwd().$file));
readfile(getcwd().$file);
对于正在寻找同一问题的每个人。
TS 解决方案:
添加 exit @ 最后(由于某些原因 Firefox 需要这个)
header("Content-Type: application/pdf");
echo $pdf;
exit;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)