Code: Select all
$zip_file_name = '../pdf/KyujinDetailRodoJoukenAll.zip';
$zip = new ZipArchive();
$res = $zip->open($zip_file_name, ZipArchive::CREATE | ZipArchive::OVERWRITE)
// foreach (...) {
$zip->addFile('../pdf/' . $kyujin_id . '.pdf', $kyujin_id . '.pdf');
//}
$zip->close();
$save_file = 'KyujinDetailRodoJoukenAll.zip';
// Force download
header("Content-type: application/x-file-to-save");
header("Content-Disposition: attachment; filename=".$save_file);
ob_end_clean();
readfile($zip_file_name);
// Remove export zip file
if (file_exists($zip_file_name)) {
unlink($zip_file_name);
}
exit;