ZipArchive::getArchiveComment

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

ZipArchive::getArchiveCommentZIP アーカイブのコメントを返す

説明

public ZipArchive::getArchiveComment(int $flags = 0): string|false

Zip アーカイブのコメントを返します。

パラメータ

flags

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

戻り値

Zip アーカイブのコメントを返します。失敗した場合に false を返します。

例1 アーカイブのコメントの出力

<?php
$zip
= new ZipArchive;
$res = $zip->open('test_with_comment.zip');
if (
$res === TRUE) {
var_dump($zip->getArchiveComment());
/* あるいはアーカイブのプロパティを使用します */
var_dump($zip->comment);
} else {
echo
'失敗、コード:' . $res;
}
?>