Php/docs/class.ziparchive

提供:Dev Guides
< Php
移動先:案内検索

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

はじめに

Zip で圧縮されたファイルアーカイブです。


クラス概要


ZipArchive implements Countable {

/* プロパティ */

int $lastId;

int $status;

int $statusSys;

int $numFiles;

string $filename;

string $comment;

/* メソッド */

public addEmptyDir ( string $dirname [, int $flags = 0 ] ) : bool

public addFile ( string $filename [, string $entryname = null [, int $start = 0 [, int $length = 0 [, int $flags = ZipArchive::FL_OVERWRITE ]]]] ) : bool

public addFromString ( string $name , string $contents [, int $flags = ZipArchive::FL_OVERWRITE ] ) : bool

public addGlob ( string $pattern [, int $flags = 0 [, array $options = array() ]] ) : array|false

public addPattern ( string $pattern [, string $path = "." [, array $options = array() ]] ) : array|false

public close ( ) : bool

public count ( ) : int

public deleteIndex ( int $index ) : bool

public deleteName ( string $name ) : bool

public extractTo ( string $destination [, mixed $entries ] ) : bool

public getArchiveComment ([ int $flags ] ) : string|false

public getCommentIndex ( int $index [, int $flags ] ) : string|false

public getCommentName ( string $name [, int $flags ] ) : string|false

public GetExternalAttributesIndex ( int $index , int &$opsys , int &$attr [, int $flags ] ) : bool

public getExternalAttributesName ( string $name , int &$opsys , int &$attr [, int $flags ] ) : bool

public getFromIndex ( int $index [, int $length = 0 [, int $flags ]] ) : string|false

public getFromName ( string $name [, int $length = 0 [, int $flags ]] ) : string|false

public getNameIndex ( int $index [, int $flags ] ) : string|false

public getStatusString ( ) : string|false

public getStream ( string $name ) : resource|false

public isCompressionMethodSupported ( int $method [, bool $encode = true ] ) : bool

public isEncryptionMethodSupported ( int $method [, bool $encode = true ] ) : bool

public locateName ( string $name [, int $flags ] ) : int|false

public open ( string $filename [, int $flags ] ) : mixed

public registerCancelCallback ( callable $callback ) : bool

public registerProgressCallback ( float $rate , callable $callback ) : bool

public renameIndex ( int $index , string $newname ) : bool

public renameName ( string $name , string $newname ) : bool

public replaceFile ( string $filename , int $index [, int $start = 0 [, int $length = 0 [, int $flags = 0 ]]] ) : bool

public setArchiveComment ( string $comment ) : bool

public setCommentIndex ( int $index , string $comment ) : bool

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

public setCompressionIndex ( int $index , int $comp_method [, int $comp_flags = 0 ] ) : bool

public setCompressionName ( string $name , int $comp_method [, int $comp_flags = 0 ] ) : bool

public setEncryptionIndex ( int $index , int $method [, string $password ] ) : bool

public setEncryptionName ( string $name , int $method [, string $password ] ) : bool

public setExternalAttributesIndex ( int $index , int $opsys , int $attr [, int $flags ] ) : bool

public setExternalAttributesName ( string $name , int $opsys , int $attr [, int $flags ] ) : bool

public setMtimeIndex ( int $index , int $timestamp [, int $flags ] ) : bool

public setMtimeName ( string $name , int $timestamp [, int $flags ] ) : bool

public setPassword ( string $password ) : bool

public statIndex ( int $index [, int $flags ] ) : array|false

public statName ( string $name [, int $flags ] ) : array|false

public unchangeAll ( ) : bool

public unchangeArchive ( ) : bool

public unchangeIndex ( int $index ) : bool

public unchangeName ( string $name ) : bool

}

プロパティ

lastId
最後に追加されたエントリのインデックス(ファイルまたはディレクトリ)。 PHP 8.0.0 以降および PECL 1.18.0 以降で利用可能です。
status
Zip アーカイブの状態。 PHP 8.0.0 以降および PECL 1.18.0 以降では、閉じられたアーカイブでも利用可能です。
statusSys
Zip アーカイブのシステム状態。 PHP 8.0.0 以降および PECL 1.18.0 以降では、閉じられたアーカイブでも利用可能です。
numFiles
アーカイブ内のファイル数
filename
ファイルシステム上のファイル名
comment
アーカイブのコメント


目次