PHP8 ZipArchive::getNameIndex

2024-02-26 14:06 更新

(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.5.0)

ZipArchive::getNameIndex — 使用索引返回条目的名称

说明

public ZipArchive::getNameIndex(int $index, int $flags = 0): string|false

使用条目的索引返回条目的名称。

参数 

index

条目的索引。

flags

如果 flags 设置为 ZipArchive::FL_UNCHANGED,则原始保持不变 返回 name。

返回值 

成功时返回名称 或者在失败时返回 false。

示例 

示例 #1 ZipArchive::getNameIndex() example

<?php
if ($zip->open('test.zip') == TRUE) {
 for ($i = 0; $i < $zip->numFiles; $i++) {
     $filename = $zip->getNameIndex($i);
     // ...
 }
}
?>


以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号