$zip = new ZipArchive();$DelFilePath="first.zip";if(file_exists($_SERVER['document_ROOT']."/TEST/".$DelFilePath)) { unlink ($_SERVER['document_ROOT']."/TEST/".$DelFilePath);}if ($zip->open($_SERVER['document_ROOT']."/TEST/".$DelFilePath, ZIPARCHIVE::CREATE) != TRUE) { die ("Could not open archive");} $zip->addFile("file_path","file_name");// close and save archive$zip->close();TEST是您的项目文件夹名称。
您可以根据需要定义路径。



