php – 发送标题以下载PDF时,Safari附加.html

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了php – 发送标题以下载PDF时,Safari附加.html脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
这是请求和响应标头
http://www.example.COM/get/pDF

GET /~get/pdf HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Accept: text/htML,application/xhtml+XMl,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://www.example.com
Cookie: etc 

HTTP/1.1 200 OK
Date: Thu,29 APR 2010 02:20:43 GMT
Server: apache/2.2.14 (Unix) mod_ssl/2.2.14 OPEnSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimITed/1.4 FrontPage/5.0.2.2635
X-Powered-By: Me
Expires: Thu,19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Cache-Control: private
Content-Disposition: attachment; filename="File #1.pdf"
Content-Length: 18776
Keep-Alive: timeout=5,max=100
Connection: Keep-Alive
Content-type: text/html; charset=utf-8
----------------------------------------------------------

基本上,响应头是由DOMPDF的stream()方法发送的.

在Firefox中,该文件提示为File#1.pdf.但是,在Safari中,该文件保存为File#1.pdf.html.

有谁知道为什么Safari将html扩展名附加到文件名?

我也在使用Kohana 3,从控制器方法提供PDF.

从我看到的内容类型不正确,我相信如果这是固定的,你的问题将得到解决.

脚本宝典总结

以上是脚本宝典为你收集整理的php – 发送标题以下载PDF时,Safari附加.html全部内容,希望文章能够帮你解决php – 发送标题以下载PDF时,Safari附加.html所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。