面临使用 fpdf 生成 pdf 的问题
我收到以下代码的 http500,我不确定出了什么问题。我是 php 新手。我已检查 PDF.php 是否位于正确的目录中,字体也是如此
<?php
define('FPDF_FONTPATH','/home/php/File/PDF/fonts/');
require('/home/php/File/PDF.php');
$pdf=new FPDF('P', 'mm', array(100,150));
$pdf->AddPage();
$pdf->SetFont('times');
$pdf->Cell(40,10,'Hello World!');
$pdf->Output("ruchit.pdf", D);
?>
I am getting http500 for the code below,I am not sure what is wrong. I am new to php. I have checked that PDF.php is in the right directory and so does fonts
<?php
define('FPDF_FONTPATH','/home/php/File/PDF/fonts/');
require('/home/php/File/PDF.php');
$pdf=new FPDF('P', 'mm', array(100,150));
$pdf->AddPage();
$pdf->SetFont('times');
$pdf->Cell(40,10,'Hello World!');
$pdf->Output("ruchit.pdf", D);
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是为了确定:
/.../fpdf16/fpdf.php
和/.../fpdf16/font/
'D'
两边加上引号,以避免出现此通知:注意:使用未定义的常量 D - 假设为“D”
为我的系统设置正确的路径并引用常量/字符串后,“它对我有用”......
所以,问题:您是否有任何错误,例如 Apache 的日志中?
Just to be sure :
/.../fpdf16/fpdf.php
and/.../fpdf16/font/
'D'
, to avoid this notice :Notice: Use of undefined constant D - assumed 'D'
Just after setting the right pathes for my system, and quoting the constant/string, "it works for me"...
... So, question : do you have any error, in Apache's log for example ?