php ZipArchive计算归档中的文件数 [英] php ZipArchive count number of files inside archive

查看:718
本文介绍了php ZipArchive计算归档中的文件数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码:

$za = new ZipArchive();
$za->open($downloadlink);
echo "Number of files inside Zip = Unknown";
            for( $i = 0; $i < $za->numFiles; $i++ ){
                $stat = $za->statIndex( $i );
                $tounes = array( basename( $stat['name'] ) . PHP_EOL );
                foreach($tounes as $toune) {
                echo $toune;
                }
            }

我想显示档案中的档案数之前显示列表。

I want to display the number of files inside the archive before displaying the list. How can i do that ?

推荐答案

您的 c> loop:

You already have the answer in your for loop:

echo "Number of files inside Zip = ".$za->numFiles;

http://php.net/manual/en/class.ziparchive.php

这篇关于php ZipArchive计算归档中的文件数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆