Php tcpdf:使用tcpdf将多个文件添加到zip目录

Php tcpdf:使用tcpdf将多个文件添加到zip目录,php,zend-framework2,tcpdf,php-7,fpdi,Php,Zend Framework2,Tcpdf,Php 7,Fpdi,在zend中使用Tcpdf,但无法将文件添加到zip 这就是我尝试过的 require_once('eng.php'); require_once('tcpdf.php'); $pageLayout = array(750, 800); $content=Array( '<html><body>Document A</body></html>', '<html><body>Document B</body>

在zend中使用Tcpdf,但无法将文件添加到zip 这就是我尝试过的

require_once('eng.php');
require_once('tcpdf.php');
$pageLayout = array(750, 800); 

$content=Array(
 '<html><body>Document A</body></html>',
 '<html><body>Document B</body></html>',
 '<html><body>Document C</body></html>'
);

$zip = new ZipArchive();
$filename = "/tmp/final.zip";
$zip->open($filename, ZipArchive::CREATE);

foreach($content as $i=>$html){
    $pdf =new TCPDF('P', 'pt', $pageLayout, true, 'UTF-8', false);
    $pdf->SetCreator(PDF_CREATOR);
    $pdf->AddPage();
    $pdf->writeHTML($html, true, false, true, false, '');
    $pdf->lastPage();
    $pdf->Output('/tmp/filename_' . $i . '.pdf', 'F');
    if(!file_exists('/tmp/filename_' . $i . '.pdf')){
        echo "File Doesn't Exist...";exit;
    }
    $zip->addFile('/tmp/filename_' . $i . '.pdf','filename_' . $i . '.pdf');
}

$zip->close();

header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="final.zip"');
readfile($filename);
require_once('eng.php');
一次需要_('tcpdf.php');
$pageLayout=阵列(750800);
$content=Array(
"文件A",,
“文件B”,
“文件C”
);
$zip=新的ZipArchive();
$filename=“/tmp/final.zip”;
$zip->open($filename,ZipArchive::CREATE);
foreach($i=>$html的内容){
$pdf=新的TCPDF('P','pt',$pageLayout,true,'UTF-8',false);
$pdf->SetCreator(pdf\u CREATOR);
$pdf->AddPage();
$pdf->writeHTML($html,true,false,true,false,”);
$pdf->lastPage();
$pdf->Output('/tmp/filename.'$i'.pdf',F');
如果(!file_存在('/tmp/filename.'$i.'.pdf')){
echo“文件不存在…”退出;
}
$zip->addFile('/tmp/filename.'$i.'.pdf','filename.'$i.'.pdf');
}
$zip->close();
标题(“内容类型:应用程序/zip”);
标题('Content-Disposition:attachment;filename=“final.zip”');
readfile($filename);
给出了错误

警告:福朋(file:///tmp/filename_179367.pdf):无法打开 流:没有这样的文件或目录


哪一行显示该错误?这一行是TCPDFN,在第1854行的…\tecnickcom\tcpdf\include\tcpdf\u static.php中没有这样的文件或目录,您是否有
/tmp/
的写入权限?那个目录存在吗?