PHP8 ZipArchive::statIndex

2024-02-27 11:09 更新

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

ZipArchive::statIndex — 獲取由其索引定義的條目的詳細(xì)信息

說明

public ZipArchive::statIndex(int $index, int $flags = 0): array|false

該函數(shù)獲取有關(guān)其定義的條目的信息 指數(shù)。

參數(shù) 

index

條目的索引

flags

ZipArchive::FL_UNCHANGED 可以 OR 到它請求 有關(guān)存檔中原始文件的信息, 忽略所做的任何更改。

返回值 

返回一個(gè)包含條目詳細(xì)信息的數(shù)組,或者在失敗時(shí)返回 false。

示例 

示例 #1 轉(zhuǎn)儲條目的統(tǒng)計(jì)信息

<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip');
if ($res === TRUE) {
    print_r($zip->statIndex(3));
    $zip->close();
} else {
    echo 'failed, code:' . $res;
}
?>

以上示例的輸出類似于:

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


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號