时间:2021-07-01 10:21:17 帮助过:2人阅读
// Creating object of the ZipArchive $zip = new ZipArchive(); $ow = 1; $file= "c:\\master.zip"; if($zip->open($file,$ow?ZIPARCHIVE::OVERWRITE:ZIPARCHIVE::CREATE)===TRUE) { //增加一个文件 $zip->addFile("c:\\master.txt"); //a1.txt会被保存加压到a2.txt $zip->addFile("c:\\a1.txt", "c:\\a2.txt"); $zip->addFile("c:\\a3.txt"); //关闭 $zip->close(); } ?>
$zip = new ZipArchive(); //打开master.zip if ($zip->open("master.zip") === TRUE) { //解压的路径 $zip->extractTo("/path/to/folder/"); $zip->close(); } // 只解压一个文件 // Open master.zip for extracting single files if ($zip->open("master.zip") === TRUE) { // Will extract only fonts.css from master.zip to given path. $zip->extractTo("/path/to/folder/","fonts.css"); $zip->close(); } //解压多个文件 if ($zip->open("master.zip") === TRUE) { $files = array("fonts.css","master.css"); $zip->extractTo("/path/to/folder/",$files); $zip->close(); }
爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具
http://biancheng.dnbcw.info/php/350525.html pageNo:3