我正在使用FPDF生成PDF文档。我想将副本保存到文件系统以获取我们的记录,并将用户的副本输出到浏览器。由于某种原因,我无法将文件保存到文件系统。任何人都可以看到它可能是什么?该文件夹的权限设置为777,因此不应该是问题。
<?php
include('./fpdf181/fpdf.php');
include('./FPDI-1.6.1/fpdi.php');
//get user's name
$name = $_GET['name'];
// initiate FPDI
$pdf = new FPDI();
// add a page
$pdf->AddPage();
// set the sourcefile
$pdf->setSourceFile('../uploads/certificates/IBA-Certificate-Coaching-Course.pdf');
// import page 1
$tplIdx = $pdf->importPage(1);
// use the imported page as the template
$pdf->useTemplate($tplIdx, 0, 0,210, 180, true);
// now write some text above the imported page
$pdf->SetFont('Arial','B',14);
$pdf->SetTextColor(0,0,0);
//member's name
$pdf->SetXY(88, 85);
$pdf->Write(0, $name);
//current date
$date = date("m/d/Y");
$pdf->SetXY(35, 140);
$pdf->Write(0, $date);
//save copy to file system
$pdf->Output('./certificates/certificate-of-coaching-readiness.pdf','F');
//output a copy to the user
$pdf->Output('certificate-of-coaching-readiness.pdf', 'D');
?>