当我使用帖子表格时

发布于 2025-01-29 13:48:27 字数 501 浏览 0 评论 0原文

我正在使用生成的PDF按钮,该按钮是帖子方法,此帖子向您打开了一个新窗口,打开了PDF。 (直到这里都不错)。但是,当我尝试下载name report.pdf出现report.php时。

你知道会发生什么吗?

在这里,我将输出的代码留给您:

header("Content-type:application/pdf");
$filename = 'Report -'.date("d-m-Y").'.pdf';
$pdf->Output($filename,'I');

这就是我单击下载pdf

“在此处输入图像说明”

I am working on a generate PDF button that it's a POST method and this POST opens to you a new window opens a PDF. (Until here all nice). But when I try to download instead the name report.pdf appears report.php.

Do you know what can it happening?

Here I left to you the code what I output FPDF:

header("Content-type:application/pdf");
$filename = 'Report -'.date("d-m-Y").'.pdf';
$pdf->Output($filename,'I');

And this is what happens when I click to download on the PDF

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

り繁华旳梦境 2025-02-05 13:48:27

对我来说并不完全清楚,您的意思是“ 当我在PDF 上单击下载时”。也许它可以与一个内容词语标头配合使用:

$filename = 'Report -'.date("d-m-Y").'.pdf';
header("Content-type:application/pdf");
header('Content-Disposition: attachment; filename="'.$filename.'"');
$pdf->Output($filename,'I');

It's not completely clear to me, what you mean by "when I click to download on the PDF". Maybe it works with a Content-Disposition-Header:

$filename = 'Report -'.date("d-m-Y").'.pdf';
header("Content-type:application/pdf");
header('Content-Disposition: attachment; filename="'.$filename.'"');
$pdf->Output($filename,'I');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文