FPDF 将文件保存在服务器 QNAP(NAS) 上的文件夹中?
FPDF Saving file in a folder on the server QNAP(NAS)?
大家好,我有一个 FPDF 脚本和 PHP 用于创建和保存 PDF 文档。该脚本不起作用(我猜我保存路径的方式是错误的)。
我希望用户单击保存并且文档必须保存在托管网站的服务器内的文件夹中(在本例中是 QNAP)。这是脚本:
<?php
session_start();
$user = $_SESSION['username'];
$sicep = $_SESSION['sicep'];
$notesicep = $_SESSION['notesicep'];
require ('fpdf/fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',11);
$pdf->Cell(100, 8, 'Operatore Centrale Operativa: '.$user, 1 ,1);
$pdf->Cell(100, 8, 'Effettuato in data: ' .date("d/m/Y"). ' In ora: '.date("h:ia") , 1 ,1);
$pdf->Cell(180, 10, 'Verifica funzionale sistema SICEP MVS NET:',1,1);
$pdf->Cell(180, 10, $sicep,1,1);
$pdf->Cell(180, 10, 'Note: '.$notesicep,1,1);
$filename = "orario".date("d/m/Y")."-".date("h:ia").".pdf";
$dir = "/Web/PDF";
$pdf->Output($dir.$filename);
?>
脚本位置是:
\192.168.1x.x\Web\Verifiche
PDF 文件应该保存在这个位置:
\192.168.1x.x\Web\PDF
我该怎么做?
如 FPDF documentation 中所述,您必须使用 F 作为输出函数的参数才能将 PDF 保存在本地服务器上:
$pdf->Output('F','/path/filename.pdf');
大家好,我有一个 FPDF 脚本和 PHP 用于创建和保存 PDF 文档。该脚本不起作用(我猜我保存路径的方式是错误的)。 我希望用户单击保存并且文档必须保存在托管网站的服务器内的文件夹中(在本例中是 QNAP)。这是脚本:
<?php
session_start();
$user = $_SESSION['username'];
$sicep = $_SESSION['sicep'];
$notesicep = $_SESSION['notesicep'];
require ('fpdf/fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',11);
$pdf->Cell(100, 8, 'Operatore Centrale Operativa: '.$user, 1 ,1);
$pdf->Cell(100, 8, 'Effettuato in data: ' .date("d/m/Y"). ' In ora: '.date("h:ia") , 1 ,1);
$pdf->Cell(180, 10, 'Verifica funzionale sistema SICEP MVS NET:',1,1);
$pdf->Cell(180, 10, $sicep,1,1);
$pdf->Cell(180, 10, 'Note: '.$notesicep,1,1);
$filename = "orario".date("d/m/Y")."-".date("h:ia").".pdf";
$dir = "/Web/PDF";
$pdf->Output($dir.$filename);
?>
脚本位置是:
\192.168.1x.x\Web\Verifiche
PDF 文件应该保存在这个位置:
\192.168.1x.x\Web\PDF
我该怎么做?
如 FPDF documentation 中所述,您必须使用 F 作为输出函数的参数才能将 PDF 保存在本地服务器上:
$pdf->Output('F','/path/filename.pdf');