PHP 8.1.28 Released!

ZipArchive::statName

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

ZipArchive::statName名前を使用してエントリの詳細を取得する

説明

public ZipArchive::statName(string $name, int $flags = 0): array|false

この関数は、名前を使用してエントリの詳細情報を取得します。

パラメータ

name

エントリの名前。

flags

名前をどのように探すのかを設定します。 また ZipArchive::FL_UNCHANGED を OR で連結すると、 アーカイブ内に最初に記録された際の情報を取得します。 変更内容は無視されます。

戻り値

エントリの詳細を含む配列を返します。失敗した場合に false を返します。

例1 エントリの情報の出力

<?php
$zip
= new ZipArchive;
$res = $zip->open('test.zip');
if (
$res === TRUE) {
print_r($zip->statName('foobar/baz'));
$zip->close();
} else {
echo
'失敗、コード:' . $res;
}
?>

上の例の出力は、 たとえば以下のようになります。

Array
(
    [name] => foobar/baz
    [index] => 3
    [crc] => 499465816
    [size] => 27
    [mtime] => 1123164748
    [comp_size] => 24
    [comp_method] => 8
)
add a note

User Contributed Notes 1 note

up
-1
Stewart Rice
14 years ago
Since a Unix Timestamp is measured in seconds, not milliseconds, I would have to assume that mtime is 'modified time' rather than 'millisecond time'... however it does not appear to work on a Linux system
To Top