Home  >  Article  >  Backend Development  >  PHP code to read detailed information of zip file

PHP code to read detailed information of zip file

WBOY
WBOYOriginal
2016-07-25 09:11:051065browse
  1. $zip = zip_open("20101105.zip");
  2. if ($zip) {
  3. while ($zip_entry = zip_read($zip)) {
  4. echo "Name: " . zip_entry_name($zip_entry) . "
    ";
  5. echo "Actual Filesize: " . zip_entry_filesize($zip_entry) . "
    ";
  6. echo "Compressed Size: " . zip_entry_compressedsize($zip_entry) . "
    ";
  7. echo "Compression Method: " . zip_entry_compressionmethod($zip_entry) . "
    ";
  8. if (zip_entry_open($zip, $zip_entry, "r")) {
  9. echo "File Contents:" . "
    ";
  10. $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
  11. echo "$buf";
  12. zip_entry_close($zip_entry);
  13. }
  14. echo "
    ";
  15. }
  16. zip_close($zip);
  17. }
  18. ?>
复制代码


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn