我有这个代码
原文链接:https://www.f2er.com/php/132372.html<?PHP $files = array('includes/s.xlsx','includes/test.html'); $zipname = 'file.zip'; $zip = new ZipArchive; $zip->open($zipname,ZipArchive::CREATE); foreach ($files as $file) { $zip->addFile($file); } $zip->close(); header('Content-Type: application/zip'); header('Content-disposition: attachment; filename=filename.zip'); header('Content-Length: ' . filesize($zipname)); readfile($zipname);