PHP Conference Japan 2024

ZipArchive::setCommentName

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

ZipArchive::setCommentName設定指定名稱項目的註解

說明

public ZipArchive::setCommentName(字串 $name, 字串 $comment): 布林值

設定指定名稱項目的註解。

參數

name

項目的名稱。

comment

註解的內容。

回傳值

成功時回傳 true,失敗時回傳 false

範例

範例 #1 開啟一個壓縮檔並設定項目的註解

<?php
$zip
= new ZipArchive;
$res = $zip->open('test.zip');
if (
$res === TRUE) {
$zip->setCommentName('entry1.txt', 'new entry comment');
$zip->close();
echo
'ok';
} else {
echo
'failed';
}
?>
新增註解

使用者貢獻的註解

此頁面沒有使用者貢獻的註解。
To Top