【发布时间】:2010-10-20 20:57:59
【问题描述】:
这是我的问题。我正在尝试调用一个页面: foo.php?docID=bar 并将 PDF 返回到屏幕,该屏幕作为 BLOB 存储在数据库中。
这是我的代码中实际返回 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 中运行良好。
但是,在 IE 中,它根本不显示任何内容。如果我在另一个页面(即 google.com)上,并且我输入 URL 以转到此页面,它会说它已完成,但我的屏幕上仍然会显示 google.com。
我检查了来自 firefox 和 IE 的响应的标题。它们是相同的。
有人有什么建议吗?需要更多信息?
编辑:如果有帮助,这里是响应标题和内容的第一行:
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。
提前致谢,
~扎克
【问题讨论】:
-
我发现了问题所在。请参阅下面的解释
标签: php internet-explorer pdf https