« ZipArchive::getCommentIndex
ZipArchive::getExternalAttributesIndex »

ZipArchive::getCommentName

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

ZipArchive::getCommentName — エントリ名を使用して、エントリのコメントを返す

説明

public function ZipArchive::getCommentName(string $name, int $flags = 0): string|false

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

パラメータ

name

エントリの名前。

flags

ZipArchive::FL_UNCHANGED を指定すると、 元の変化していないコメントが返されます。

戻り値

成功した場合にコメント、失敗した場合に false を返します。

例

例1 エントリのコメントの出力

<?php
$zip = new ZipArchive;
$res = $zip->open('test1.zip');
if ($res === TRUE) {
    var_dump($zip->getCommentName('test/entry1.txt'));
} else {
    echo '失敗、コード:' . $res;
}
?>
関連キーワード:
エントリ   ZipArchive   コメント   getCommentName   flags   getCommentIndex   getExternalAttributesIndex   変化   成功   dump   entry   else   コード
関連する関数・ページ:
ziparchive.getcommentindex   ziparchive.setcommentname   ziparchive.setcommentindex   ziparchive.getfromindex   ziparchive.getfromname   ziparchive.unchangename