Home >Backend Development >PHP Tutorial >PHP reads ZIP file details_PHP tutorial
02 $zip = zip_open("20101105.zip");
03 if ($zip) {
04 while ($zip_entry = zip_read($zip)) {
05 echo "Name: " . zip_entry_name($zip_entry) . "
";
06 echo "Actual Filesize: " . zip_entry_filesize($zip_entry) . "
";
07 echo "Compressed Size: " . zip_entry_compressedsize($zip_entry) . "
";
08 echo "Compression Method: " . zip_entry_compressionmethod($zip_entry) . "
";
09 if (zip_entry_open($zip, $zip_entry, "r")) {
10 echo "File Contents:" . "
";
11 $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
12 echo "$buf";
13 zip_entry_close($zip_entry);
14 }
15 echo "
";
16 }
17 zip_close($zip);
18 }
19 ?>
摘自:尐桀的博客