Home  >  Article  >  php教程  >  PHP读取ZIP文件详细信息

PHP读取ZIP文件详细信息

WBOY
WBOYOriginal
2016-06-13 10:44:57776browse

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 ?>

摘自:尐桀的博客

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
Previous article:php 自定义函数Next article:php简单的自定义模板类