2024 年 PHP 日本研討會

ZipArchive::getCommentIndex

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

ZipArchive::getCommentIndex使用項目索引回傳項目的註解

說明

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

使用項目索引回傳項目的註解。

參數

index

項目的索引

flags

如果 flags 設定為 ZipArchive::FL_UNCHANGED,則會返回原始未變更的註釋。

回傳值

成功時返回註釋,失敗時返回 false

範例

範例 #1 傾印出項目的註釋

<?php
$zip
= new ZipArchive;
$res = $zip->open('test1.zip');
if (
$res === TRUE) {
var_dump($zip->getCommentIndex(1));
} else {
echo
'失敗,代碼:' . $res;
}
?>
新增註釋

使用者提供的註釋

此頁面沒有使用者提供的註釋。
To Top