(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.4.0)
ZipArchive::setCommentName — 設定指定名稱項目的註解
name
項目的名稱。
comment
註解的內容。
範例 #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';
}
?>