PHP 8.1.28 Released!

ZipArchive::setCommentName

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

ZipArchive::setCommentName名前を使用してエントリのコメントを設定する

説明

public ZipArchive::setCommentName(string $name, string $comment): bool

名前を使用して、エントリのコメントを設定します。

パラメータ

name

エントリの名前。

comment

コメントの内容。

戻り値

成功した場合に true を、失敗した場合に false を返します。

例1 アーカイブをオープンし、エントリのコメントを設定する

<?php
$zip
= new ZipArchive;
$res = $zip->open('test.zip');
if (
$res === TRUE) {
$zip->setCommentName('entry1.txt', '新しいエントリのコメント');
$zip->close();
echo
'成功';
} else {
echo
'失敗';
}
?>
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top