La classe ZipArchive

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

Introduction

Un fichier d'archive, compressé avec Zip.

Synopsis de la classe

classZipArchiveimplementsCountable {
publicconstintCREATE;
publicconstintEXCL;
publicconstintCHECKCONS;
publicconstintOVERWRITE;
publicconstintRDONLY;
publicconstintFL_NOCASE;
publicconstintFL_NODIR;
publicconstintFL_COMPRESSED;
publicconstintFL_UNCHANGED;
publicconstintFL_RECOMPRESS;
publicconstintFL_ENCRYPTED;
publicconstintFL_OVERWRITE;
publicconstintFL_LOCAL;
publicconstintFL_CENTRAL;
publicconstintFL_ENC_GUESS;
publicconstintFL_ENC_RAW;
publicconstintFL_ENC_STRICT;
publicconstintFL_ENC_UTF_8;
publicconstintFL_ENC_CP437;
publicconstintCM_DEFAULT;
publicconstintCM_STORE;
publicconstintCM_SHRINK;
publicconstintCM_REDUCE_1;
publicconstintCM_REDUCE_2;
publicconstintCM_REDUCE_3;
publicconstintCM_REDUCE_4;
publicconstintCM_IMPLODE;
publicconstintCM_DEFLATE;
publicconstintCM_DEFLATE64;
publicconstintCM_BZIP2;
publicconstintCM_LZMA;
publicconstintCM_LZMA2;
publicconstintCM_ZSTD;
publicconstintCM_XZ;
publicconstintCM_TERSE;
publicconstintCM_LZ77;
publicconstintCM_WAVPACK;
publicconstintCM_PPMD;
publicconstintER_OK;
publicconstintER_MULTIDISK;
publicconstintER_RENAME;
publicconstintER_CLOSE;
publicconstintER_SEEK;
publicconstintER_READ;
publicconstintER_WRITE;
publicconstintER_CRC;
publicconstintER_ZIPCLOSED;
publicconstintER_NOENT;
publicconstintER_EXISTS;
publicconstintER_OPEN;
publicconstintER_TMPOPEN;
publicconstintER_ZLIB;
publicconstintER_MEMORY;
publicconstintER_CHANGED;
publicconstintER_COMPNOTSUPP;
publicconstintER_EOF;
publicconstintER_INVAL;
publicconstintER_NOZIP;
publicconstintER_INTERNAL;
publicconstintER_INCONS;
publicconstintER_REMOVE;
publicconstintER_DELETED;
publicconstintER_ENCRNOTSUPP;
publicconstintER_RDONLY;
publicconstintER_NOPASSWD;
publicconstintER_WRONGPASSWD;
publicconstintER_OPNOTSUPP;
publicconstintER_INUSE;
publicconstintER_TELL;
publicconstintER_CANCELLED;
publicconstintER_DATA_LENGTH;
publicconstintER_NOT_ALLOWED;
publicconstintAFL_RDONLY;
publicconstintOPSYS_DOS;
publicconstintOPSYS_AMIGA;
publicconstintOPSYS_OPENVMS;
publicconstintOPSYS_UNIX;
publicconstintOPSYS_VM_CMS;
publicconstintOPSYS_ATARI_ST;
publicconstintOPSYS_OS_2;
publicconstintOPSYS_MACINTOSH;
publicconstintOPSYS_Z_SYSTEM;
publicconstintOPSYS_CPM;
publicconstintOPSYS_MVS;
publicconstintOPSYS_VSE;
publicconstintOPSYS_VFAT;
publicconstintOPSYS_BEOS;
publicconstintOPSYS_TANDEM;
publicconstintOPSYS_OS_400;
publicconstintOPSYS_OS_X;
publicconstintOPSYS_DEFAULT;
publicconstintEM_NONE;
publicconstintEM_TRAD_PKWARE;
publicconstintEM_AES_128;
publicconstintEM_AES_192;
publicconstintEM_AES_256;
publicconstintEM_UNKNOWN;
publicconstintLENGTH_TO_END;
publicreadonlyint$lastId;
publicreadonlyint$status;
publicreadonlyint$statusSys;
publicreadonlyint$numFiles;
publicreadonlystring$filename;
publicreadonlystring$comment;
publicaddEmptyDir(string$dirname, int$flags = 0): bool
publicaddFile(
    string$filepath,
    string$entryname = "",
    int$start = 0,
    int$length = ZipArchive::LENGTH_TO_END,
    int$flags = ZipArchive::FL_OVERWRITE
): bool
publicaddFromString(string$name, string$content, int$flags = ZipArchive::FL_OVERWRITE): bool
publicaddGlob(string$pattern, int$flags = 0, array$options = []): array|false
publicaddPattern(string$pattern, string$path = ".", array$options = []): array|false
publicclearError(): void
publicclose(): bool
publiccount(): int
publicdeleteIndex(int$index): bool
publicdeleteName(string$name): bool
publicextractTo(string$pathto, array|string|null$files = null): bool
publicgetArchiveComment(int$flags = 0): string|false
publicgetArchiveFlag(int$flag, int$flags = 0): int
publicgetCommentIndex(int$index, int$flags = 0): string|false
publicgetCommentName(string$name, int$flags = 0): string|false
publicgetExternalAttributesIndex(
    int$index,
    int&$opsys,
    int&$attr,
    int$flags = ?
): bool
publicgetExternalAttributesName(
    string$name,
    int&$opsys,
    int&$attr,
    int$flags = 0
): bool
publicgetFromIndex(int$index, int$len = 0, int$flags = 0): string|false
publicgetFromName(string$name, int$len = 0, int$flags = 0): string|false
publicgetNameIndex(int$index, int$flags = 0): string|false
publicgetStreamIndex(int$index, int$flags = 0): resource|false
publicgetStreamName(string$name, int$flags = 0): resource|false
publicstaticisCompressionMethodSupported(int$method, bool$enc = true): bool
publicstaticisEncryptionMethodSupported(int$method, bool$enc = true): bool
publiclocateName(string$name, int$flags = 0): int|false
publicopen(string$filename, int$flags = 0): bool|int
publicrenameIndex(int$index, string$new_name): bool
publicrenameName(string$name, string$new_name): bool
publicreplaceFile(
    string$filepath,
    int$index,
    int$start = 0,
    int$length = ZipArchive::LENGTH_TO_END,
    int$flags = 0
): bool
publicsetArchiveComment(string$comment): bool
publicsetArchiveFlag(int$flag, int$value): bool
publicsetCommentIndex(int$index, string$comment): bool
publicsetCommentName(string$name, string$comment): bool
publicsetCompressionIndex(int$index, int$method, int$compflags = 0): bool
publicsetCompressionName(string$name, int$method, int$compflags = 0): bool
publicsetEncryptionIndex(int$index, int$method, ?string$password = null): bool
publicsetEncryptionName(string$name, int$method, ?string$password = null): bool
publicsetExternalAttributesIndex(
    int$index,
    int$opsys,
    int$attr,
    int$flags = 0
): bool
publicsetExternalAttributesName(
    string$name,
    int$opsys,
    int$attr,
    int$flags = 0
): bool
publicsetMtimeIndex(int$index, int$timestamp, int$flags = 0): bool
publicsetMtimeName(string$name, int$timestamp, int$flags = 0): bool
publicsetPassword(string$password): bool
publicstatIndex(int$index, int$flags = 0): array|false
publicstatName(string$name, int$flags = 0): array|false
publicunchangeAll(): bool
publicunchangeIndex(int$index): bool
publicunchangeName(string$name): bool
}

Propriétés

lastId

Valeur de l'index de la dernière entrée (fichier ou dossier) Disponible à partir de PHP 8.0.0 et PECL zip 1.18.0.

status

Le statut de l'archive Zip. Disponible pour les archives fermées, à partir de PHP 8.0.0 et PECL zip 1.18.0.

statusSys

Le statut système de l'archive Zip. Disponible pour les archives fermées, à partir de PHP 8.0.0 et PECL zip 1.18.0.

numFiles

Le nombre de fichiers dans l'archive

filename

Le nom du fichier dans le système de fichiers

comment

Commentaire pour l'archive

Sommaire

To Top