简体   繁体   English

php-PDF文件未生成(使用FPDF)

[英]php-PDF file not generating(using FPDF)

I am running a simple example like this : 我正在运行一个像这样的简单示例:

<?php require('fpdf/fpdf.php');
 $pdf = new FPDF();
 $pdf->AddPage();
 $pdf->SetFont('Arial','B',16);
 $pdf->Cell(40,10,'Hello World!');
 $pdf->Output();
 ?> 

the output which was expected as like a pdf page with a text of Hello World Written in it...but I got no pdf ..there is no error generation neither in the page nor in the console.the page came blank that's not pdf file..So how to fix this..? 预期的输出像是在其中写有Hello World文本的pdf页面...但是我没有pdf ..在页面和控制台中都没有错误生成。页面变成非pdf的空白文件..那么如何解决此问题..?

您应该添加文件名;

$pdf->Output("myPdfFile.pdf", "F");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM