$zip = new ZipArchive();$res = $zip->open('test.zip', ZipArchive::CREATE); //不存在则创建$filepath = 'sendmsg.php';$zip->addFile($filepath);$zip->close();