0

执行以下代码后,浏览器会自动下载 PDF 文档。当我打开那个 PDF 时,我遇到了错误。

在此处输入图像描述 我从源代码中得到了以下片段的想法

<?php
$filename = "yourfilename.pdf";
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: application/pdf");
header("Content-Disposition: attachment; filename=$filename");
header("Content-Transfer-Encoding: binary");
echo "my contents should display in PDF Document";
?>
4

0 回答 0