我想将PDF文件保存到用户指定的目录中。 我正在使用FPDF。 以下是代码:
<?php
//echo "<meta http-equiv=\"refresh\" content=\"0;url=http://www.train2invest.net/useradmin/atest_Khan.php\">";
require('fpdf.php');
//create a FPDF object
$pdf=new FPDF();
//set font for the entire document
$pdf->SetFont('times','',12);
$pdf->SetTextColor(50,60,100);
//set up a page
$pdf->AddPage('P');
$pdf->SetDisplayMode(real,'default');
//Set x and y position for the main text, reduce font size and write content
$pdf->SetXY (10,60);
$pdf->SetFontSize(12);
$pdf->Write(5,'Dear Ms.XYX');
$filename="test.pdf";
//Output the document
$dir = "/G:/PDF/test.pdf/"; // full path like C:/xampp/htdocs/file/file/
$pdf->Output($dir.$filename,'F');
?>
即使我在文件名中加入"G:\PDF\"
,它也不会保存!我尝试了以下方法:
$filename="G:\PDF\test.pdf";
$pdf->Output($filename.'.pdf','F');
$filename="G:\\PDF\\test.pdf";
$pdf->Output($filename.'.pdf','F');
$filename="G:/PDF/test.pdf";
$pdf->Output($filename.'.pdf','F');
$filename="/G:/PDF/test.pdf/";
$pdf->Output($filename.'.pdf','F');
我已经检查过我想要写入的目录具有读写权限并且确实存在。但它仍然无法工作!
请有人帮帮我...
php
标签来提高问题的可读性并吸引相关人员的注意。 - IshOutput()
程序是否正常工作了吗? 尝试将 'F' 切换为 'D'。 - Orbling