http://www.php.cn/manual/view/1499.html
$objZipArchive = new ZipArchive(); if($objZipArchive->open('/tmp/test.zip', ZipArchive::OVERWRITE)) { $objZipArchive->addFile('/tmp/a.txt', 'ae.txt'); $objZipArchive->addFile('/tmp/b.txt', 'be.txt'); $objZipArchive->close(); echo 'ok'; } else { echo 'open error'; } $file = '/tmp/test.zip'; $zip = zip_open ( $file); if ( $zip ) { while ( $zip_entry = zip_read ( $zip )) { echo "Name: " . zip_entry_name ( $zip_entry ) . " " ; echo "Actual Filesize: " . zip_entry_filesize ( $zip_entry ) . " " ; echo "Compressed Size: " . zip_entry_compressedsize ( $zip_entry ) . " " ; echo "Compression Method: " . zip_entry_compressionmethod ( $zip_entry ) . " " ; if ( zip_entry_open ( $zip , $zip_entry , "r" )) { echo "File Contents: " ; $buf = zip_entry_read ( $zip_entry , zip_entry_filesize ( $zip_entry )); echo " $buf " ; zip_entry_close ( $zip_entry ); } echo " " ; } zip_close ( $zip ); }