我有这个代码:
$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;
}
}
Run Code Online (Sandbox Code Playgroud)
我想在显示列表之前显示存档内的文件数.我怎样才能做到这一点 ?
你已经在for循环中得到了答案:
echo "Number of files inside Zip = ".$za->numFiles;
Run Code Online (Sandbox Code Playgroud)
http://php.net/manual/en/class.ziparchive.php