Home  >  Article  >  Backend Development  >  怎么获得ZIP文件中压缩文件的个数

怎么获得ZIP文件中压缩文件的个数

WBOY
WBOYOriginal
2016-06-13 13:12:591242browse

如何获得ZIP文件中压缩文件的个数?
在PHP中,如何获得ZIP文件中压缩文件的个数?

------解决方案--------------------
这样写

PHP code
$zip= zip_open('zip文件名');
$n = 0;
while($rs = zip_read($zip)) {
  $f = zip_entry_name($rs); //取得文件名
  if(substr($f, -1) != '/') $n++;
}
echo $n; <div class="clear">
                 
              
              
        
            </div>
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