PHP8 ZipArchive::renameIndex

2024-02-27 11:09 更新

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

ZipArchive::renameIndex — 重命名由其索引定义的条目

说明

public ZipArchive::renameIndex(int $index, string $new_name): bool

重命名由其索引定义的条目。

参数 

index

要重命名的条目的索引。

new_name

新名称。

返回值 

成功时返回 true, 或者在失败时返回 false。

示例 

示例 #1 重命名一个条目

<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip');
if ($res === TRUE) {
    $zip->renameIndex(2,'newname.txt');
    $zip->close();
} else {
    echo 'failed, code:' . $res;
}
?>


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

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号