(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 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
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
- アーカイブのコメント
目次
- ZipArchive::addEmptyDir — 新しいディレクトリを追加する
- ZipArchive::addFile — 指定したパスからファイルを ZIP アーカイブに追加する
- ZipArchive::addFromString — 内容を指定して、ファイルを ZIP アーカイブに追加する
- ZipArchive::addGlob — ディレクトリから、glob パターンを使ってファイルを追加する
- ZipArchive::addPattern — ディレクトリから、PCRE パターンを使ってファイルを追加する
- ZipArchive::close — アクティブな (オープンされた、あるいは新しく作成された) アーカイブを閉じる
- ZipArchive::count — アーカイブにあるファイルの数を数える
- ZipArchive::deleteIndex — インデックスを使用して、アーカイブ内のエントリを削除する
- ZipArchive::deleteName — 名前を使用して、アーカイブからエントリを削除する
- ZipArchive::extractTo — アーカイブの内容を展開する
- ZipArchive::getArchiveComment — ZIP アーカイブのコメントを返す
- ZipArchive::getCommentIndex — エントリのインデックスを使用して、エントリのコメントを返す
- ZipArchive::getCommentName — エントリ名を使用して、エントリのコメントを返す
- ZipArchive::getExternalAttributesIndex — インデックスで定義されたエントリの外部属性を取得する
- ZipArchive::getExternalAttributesName — 名前で定義されたエントリの外部属性を取得する
- ZipArchive::getFromIndex — インデックスを使用して、エントリの内容を返す
- ZipArchive::getFromName — 名前を使用して、エントリの内容を返す
- ZipArchive::getNameIndex — インデックスを使用して、エントリの名前を返す
- ZipArchive::getStatusString — システムエラー、または ZIP メッセージに関するエラー情報を返す
- ZipArchive::getStream — 名前を使用して、エントリのファイルハンドラ (読み込み専用) を取得する
- ZipArchive::isCompressionMethodSupported — 圧縮方式を libzip がサポートしているかをチェックする
- ZipArchive::isEncryptionMethodSupported — 暗号化方式を libzip がサポートしているかどうかをチェックする
- ZipArchive::locateName — アーカイブ内のエントリのインデックスを返す
- ZipArchive::open — ZIP ファイルアーカイブをオープンする
- ZipArchive::registerCancelCallback — アーカイブを閉じている間にキャンセルできるようにコールバックを登録する
- ZipArchive::registerProgressCallback — アーカイブを閉じている間に更新できるようにコールバックを登録する
- ZipArchive::renameIndex — インデックスを使用してエントリ名を変更する
- ZipArchive::renameName — 名前を使用してエントリ名を変更する
- ZipArchive::replaceFile — 指定されたパスのファイルにアーカイブの一部を置き換える
- ZipArchive::setArchiveComment — ZIP アーカイブのコメントを設定する
- ZipArchive::setCommentIndex — インデックスを使用してエントリのコメントを設定する
- ZipArchive::setCommentName — 名前を使用してエントリのコメントを設定する
- ZipArchive::setCompressionIndex — インデックスで定義されたエントリの圧縮方法を設定する
- ZipArchive::setCompressionName — 名前で定義されたエントリの圧縮メソッドを設定する
- ZipArchive::setEncryptionIndex — index で定義されたエントリの暗号化方法を指定する
- ZipArchive::setEncryptionName — 名前で定義されたエントリの暗号化方式を設定する
- ZipArchive::setExternalAttributesIndex — インデックスで定義されたエントリの外部属性を設定する
- ZipArchive::setExternalAttributesName — 名前で定義されたエントリの外部属性を設定する
- ZipArchive::setMtimeIndex — インデックスを使用してエントリの変更時間を設定する
- ZipArchive::setMtimeName — 名前を使ってエントリの変更時間を設定する
- ZipArchive::setPassword — アクティブなアーカイブにパスワードを設定する
- ZipArchive::statIndex — インデックスを使用してエントリの詳細を取得する
- ZipArchive::statName — 名前を使用してエントリの詳細を取得する
- ZipArchive::unchangeAll — アーカイブに対するすべての変更を取り消す
- ZipArchive::unchangeArchive — アーカイブ全体に対して行われたすべての変更を取り消す
- ZipArchive::unchangeIndex — 指定したインデックスのエントリに対するすべての変更を取り消す
- ZipArchive::unchangeName — 指定した名前のエントリに対するすべての変更を取り消す
/* プロパティ */