我想通过这个循环下载我的数据库中包含的所有pdf。 当我单击按钮时,只下载第一个文件。
<?php
include_once('functions/functions.php');
require_once('../invoice/html2pdf.class.php');
if (isset($_GET['download'])) {
if ($_GET['download'] == 'all') {
$req = sql_query("SELECT * FROM invoice");
$content = '';
while ($res = mysqli_fetch_assoc($req)) {
$html2pdf = new HTML2PDF('P', 'A4', 'fr');
$html2pdf->setDefaultFont('Arial');
$content = $res['content'];
$html2pdf->writeHTML($content);
ob_end_clean();
$html2pdf->Output('' . $res['date'] . '-' . $res['user'] . '.pdf', 'D');
}
}
}
?>
<panel class="panel panel-flat">
<a href="invoice?download=all">Télécharger toutes les factures</a>
</panel>
答案 0 :(得分:1)
每次下载只能提供1个文件。
您当然可以将它们全部添加到zip存档中,并提供下载。