IE(HTTPS):从php文件生成pdf不起作用

前端之家收集整理的这篇文章主要介绍了IE(HTTPS):从php文件生成pdf不起作用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的问题.我试图调用一个页面:foo.PHP?docID = bar并将PDF返回到在DB中作为BLOB存储的屏幕.

这是我的代码实际返回PDF的部分:

  1. $docID = isset($_REQUEST['docID']) ? $_REQUEST['docID'] : null;
  2.  
  3. if ($docID == null){
  4. die("Document ID was not given.");
  5. }
  6.  
  7. $results = getDocumentResults($docID);
  8.  
  9. if (verifyUser($user,$results['ProductId'])){
  10. header('Content-type: application/pdf');
  11. // this is the BLOB data from the results.
  12. print $results[1];
  13. }
  14. else{
  15. die('You are not allowed to view this document.');
  16. }

这在Firefox中工作得很好.

但是,在IE中,它根本不显示任何东西.如果我在另一个网页(即google.com)上,并输入网址即可进入此页面,它会说明已经完成,但我仍然会在我的屏幕上显示google.com.

我检查了来自firefox和IE的响应的标题.他们是一样的

有没有人有什么建议?需要更多信息?

编辑:如果它有帮助,这里是响应标题内容的第一行:

  1. HTTP/1.1 200 OK
  2. Cache-Control: no-store,no-cache,must-revalidate,post-check=0,pre-check=0
  3. Pragma: no-cache
  4. Content-Length: 349930
  5. Content-Type: application/pdf
  6. Expires: Thu,19 Nov 1981 08:52:00 GMT
  7. Server: Microsoft-IIS/6.0
  8. X-Powered-By: PHP/5.1.2
  9. Set-Cookie: PHPSESSID=cql3n3oc13crv3r46h2q04dvq4; path=/; domain=.example.com
  10. Content-Disposition: inline; filename='downloadedFile.pdf'
  11. X-Powered-By: ASP.NET
  12. Date: Tue,21 Apr 2009 16:35:59 GMT
  13.  
  14. %PDF-1.4

编辑:此外,拉出pdf文件页面实际上使用HTTPS而不是HTTP.

提前致谢,

〜扎克

我想出了什么问题.这是一个处理IE,HTTPS和插件的IE错误. (见 here)

这是一个缓存问题.当我设置:

  1. header("Cache-Control: max-age=1");
  2. header("Pragma: public");

(见here),这个PDF缓存足够长,足以让adobe reader加载项抓住它.

猜你在找的PHP相关文章