IE(HTTPS):从php文件生成pdf不起作用 [英] IE (HTTPS): generating pdf from php file doesn't work

查看:178
本文介绍了IE(HTTPS):从php文件生成pdf不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题。我正在尝试调用页面:foo.php?docID = bar并将PDF返回到屏幕,该屏幕在数据库中存储为BLOB。

Here is my issue. I am trying to call a page: foo.php?docID=bar and return a PDF to the screen which is stored as a BLOB in the DB.

以下是我的代码中实际返回PDF的部分:

Here is the portion of my code which actually returns the PDF:

$docID = isset($_REQUEST['docID']) ? $_REQUEST['docID'] : null;

if ($docID == null){
    die("Document ID was not given.");
}

$results = getDocumentResults($docID);

if (verifyUser($user, $results['ProductId'])){
    header('Content-type: application/pdf');
    // this is the BLOB data from the results.
    print $results[1];
}
else{
    die('You are not allowed to view this document.');
}

这在Firefox中完全正常。

This works perfectly fine in Firefox.

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

However, in IE, it doesn't show anything at all. If i'm on another page (i.e. google.com), and I type in the URL to go to this page, it will say it's done, but I will still have google.com on my screen.

我检查了来自firefox和IE的响应的标头。它们完全相同。

I checked the headers for the responses from both firefox and IE. They are identical.

有没有人有任何建议?需要更多信息?

Does anyone have any suggestions? Need more information?

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

EDIT: If it helps at all, here's the response header and the first line of the content:

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

%PDF-1.4

编辑:此外,提取pdf文件的页面实际上使用HTTPS而不是HTTP。

EDIT: Also, the page which pulls out the pdf file actually uses HTTPS instead of HTTP.

提前致谢,

~Zack

推荐答案

我弄清楚问题是什么。这是一个处理IE,HTTPS和插件的IE漏洞。 (参见此处

I figured out what the issue was. It's an IE bug dealing with IE, HTTPS and addons. (See here)

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

It was a caching issue. When I set:

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

(参见这里),PDF在缓存中的时间足够长,以便adobe reader add-on能够抓住它。

(see here), the PDF was in cache long enough for the adobe reader add-on to grab it.

这篇关于IE(HTTPS):从php文件生成pdf不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆