ZipArchive — ZipArchive-klassen: Skillnad mellan sidversioner
Hoppa till navigering
Hoppa till sök
Admin (diskussion | bidrag) Ingen redigeringssammanfattning |
Admin (diskussion | bidrag) |
||
| (En mellanliggande sidversion av samma användare visas inte) | |||
| Rad 3: | Rad 3: | ||
=== Introduktion === | === Introduktion === | ||
Ett filarkiv | Ett filarkiv, komprimerat med Zip. | ||
=== Klassöversikt === | === Klassöversikt === | ||
| Rad 28: | Rad 28: | ||
public const int FL_ENC_UTF_8; | public const int FL_ENC_UTF_8; | ||
public const int FL_ENC_CP437; | public const int FL_ENC_CP437; | ||
public const int FL_OPEN_FILE_NOW; | |||
public const int CM_DEFAULT; | public const int CM_DEFAULT; | ||
public const int CM_STORE; | public const int CM_STORE; | ||
public const int CM_SHRINK; | |||
public const int CM_REDUCE_1; | |||
public const int CM_REDUCE_2; | |||
public const int CM_REDUCE_3; | |||
public const int CM_REDUCE_4; | |||
public const int CM_IMPLODE; | |||
public const int CM_DEFLATE; | public const int CM_DEFLATE; | ||
public const int CM_DEFLATE64; | |||
public const int CM_PKWARE_IMPLODE; | |||
public const int CM_BZIP2; | |||
public const int CM_LZMA; | |||
public const int CM_LZMA2; | |||
public const int CM_ZSTD; | |||
public const int CM_XZ; | |||
public const int CM_TERSE; | |||
public const int CM_LZ77; | |||
public const int CM_WAVPACK; | |||
public const int CM_PPMD; | |||
public const int ER_OK; | public const int ER_OK; | ||
public const int ER_MULTIDISK; | |||
public const int ER_RENAME; | |||
public const int ER_CLOSE; | |||
public const int ER_SEEK; | |||
public const int ER_READ; | |||
public const int ER_WRITE; | |||
public const int ER_CRC; | |||
public const int ER_ZIPCLOSED; | |||
public const int ER_NOENT; | public const int ER_NOENT; | ||
public const int ER_EXISTS; | public const int ER_EXISTS; | ||
public const int ER_OPEN; | |||
public const int ER_TMPOPEN; | |||
public const int ER_ZLIB; | |||
public const int ER_MEMORY; | |||
public const int ER_CHANGED; | |||
public const int ER_COMPNOTSUPP; | |||
public const int ER_EOF; | |||
public const int ER_INVAL; | |||
public const int ER_NOZIP; | |||
public const int ER_INTERNAL; | |||
public const int ER_INCONS; | |||
public const int ER_REMOVE; | |||
public const int ER_DELETED; | |||
public const int ER_ENCRNOTSUPP; | |||
public const int ER_RDONLY; | |||
public const int ER_NOPASSWD; | |||
public const int ER_WRONGPASSWD; | |||
public const int ER_OPNOTSUPP; | |||
public const int ER_INUSE; | |||
public const int ER_TELL; | |||
public const int ER_COMPRESSED_DATA; | |||
public const int ER_CANCELLED; | |||
public const int ER_DATA_LENGTH; | |||
public const int ER_NOT_ALLOWED; | |||
public const int AFL_RDONLY; | |||
public const int AFL_IS_TORRENTZIP; | |||
public const int AFL_WANT_TORRENTZIP; | |||
public const int AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE; | |||
public const int OPSYS_DOS; | |||
public const int OPSYS_AMIGA; | |||
public const int OPSYS_OPENVMS; | |||
public const int OPSYS_UNIX; | |||
public const int OPSYS_VM_CMS; | |||
public const int OPSYS_ATARI_ST; | |||
public const int OPSYS_OS_2; | |||
public const int OPSYS_MACINTOSH; | |||
public const int OPSYS_Z_SYSTEM; | |||
public const int OPSYS_CPM; | |||
public const int OPSYS_WINDOWS_NTFS; | |||
public const int OPSYS_MVS; | |||
public const int OPSYS_VSE; | |||
public const int OPSYS_ACORN_RISC; | |||
public const int OPSYS_VFAT; | |||
public const int OPSYS_ALTERNATE_MVS; | |||
public const int OPSYS_BEOS; | |||
public const int OPSYS_TANDEM; | |||
public const int OPSYS_OS_400; | |||
public const int OPSYS_OS_X; | |||
public const int OPSYS_DEFAULT; | |||
public const int EM_NONE; | |||
public const int EM_TRAD_PKWARE; | |||
public const int EM_AES_128; | |||
public const int EM_AES_192; | |||
public const int EM_AES_256; | public const int EM_AES_256; | ||
public const int EM_UNKNOWN; | |||
public const string LIBZIP_VERSION; | public const string LIBZIP_VERSION; | ||
public const int LENGTH_TO_END; | |||
public const int LENGTH_UNCHECKED; | |||
/* Egenskaper */ | /* Egenskaper */ | ||
public readonly int $lastId; | public readonly int $lastId; | ||
public readonly int $status; | public readonly int $status; | ||
public readonly int $statusSys; | |||
public readonly int $numFiles; | public readonly int $numFiles; | ||
public readonly string $filename; | public readonly string $filename; | ||
| Rad 46: | Rad 129: | ||
/* Metoder */ | /* Metoder */ | ||
public addEmptyDir(string $dirname, int $flags = 0): bool; | public addEmptyDir(string $dirname, int $flags = 0): bool; | ||
public addFile(string $filepath, string $entryname = "", int $flags = | public addFile(string $filepath, string $entryname = "", int $start = 0, int $length = ZipArchive::LENGTH_TO_END, int $flags = ZipArchive::FL_OVERWRITE): bool; | ||
public addFromString(string $name, string $content, int $flags = 0): bool; | public addFromString(string $name, string $content, int $flags = ZipArchive::FL_OVERWRITE): bool; | ||
public addGlob(string $pattern, int $flags = 0, array $options = []): array|false; | |||
public addPattern(string $pattern, string $path = ".", array $options = []): array|false; | |||
public clearError(): void; | |||
public close(): bool; | |||
public count(): int; | |||
public deleteIndex(int $index): bool; | |||
public deleteName(string $name): bool; | |||
public extractTo(string $pathto, array|string|null $files = null): bool; | public extractTo(string $pathto, array|string|null $files = null): bool; | ||
public | public getArchiveComment(int $flags = 0): string|false; | ||
public getArchiveFlag(int $flag, int $flags = 0): int; | |||
public getCommentIndex(int $index, int $flags = 0): string|false; | |||
public getCommentName(string $name, int $flags = 0): string|false; | |||
public getExternalAttributesIndex(int $index, int &$opsys, int &$attr, int $flags = 0): bool; | |||
public getExternalAttributesName(string $name, int &$opsys, int &$attr, int $flags = 0): bool; | |||
public getFromIndex(int $index, int $len = 0, int $flags = 0): string|false; | |||
public getFromName(string $name, int $len = 0, int $flags = 0): string|false; | public getFromName(string $name, int $len = 0, int $flags = 0): string|false; | ||
public setPassword(string $password): bool; | public getNameIndex(int $index, int $flags = 0): string|false; | ||
public | public getStatusString(): string; | ||
public getStream(string $name): resource|false; | |||
public getStreamIndex(int $index, int $flags = 0): resource|false; | |||
public getStreamName(string $name, int $flags = 0): resource|false; | |||
public static isCompressionMethodSupported(int $method, bool $enc = true): bool; | |||
public static isEncryptionMethodSupported(int $method, bool $enc = true): bool; | |||
public locateName(string $name, int $flags = 0): int|false; | |||
public open(string $filename, int $flags = 0): bool|int; | |||
public registerCancelCallback(callable $callback): bool; | |||
public registerProgressCallback(float $rate, callable $callback): bool; | |||
public renameIndex(int $index, string $new_name): bool; | |||
public renameName(string $name, string $new_name): bool; | |||
public replaceFile(string $filepath, int $index, int $start = 0, int $length = ZipArchive::LENGTH_TO_END, int $flags = 0): bool; | |||
public setArchiveComment(string $comment): bool; | |||
public setArchiveFlag(int $flag, int $value): bool; | |||
public setCommentIndex(int $index, string $comment): bool; | |||
public setCommentName(string $name, string $comment): bool; | |||
public setCompressionIndex(int $index, int $method, int $compflags = 0): bool; | |||
public setCompressionName(string $name, int $method, int $compflags = 0): bool; | |||
public setEncryptionIndex(int $index, int $method, #[\SensitiveParameter] ?string $password = null): bool; | |||
public setEncryptionName(string $name, int $method, #[\SensitiveParameter] ?string $password = null): bool; | |||
public setExternalAttributesIndex(int $index, int $opsys, int $attr, int $flags = 0): bool; | |||
public setExternalAttributesName(string $name, int $opsys, int $attr, int $flags = 0): bool; | |||
public setMtimeIndex(int $index, int $timestamp, int $flags = 0): bool; | |||
public setMtimeName(string $name, int $timestamp, int $flags = 0): bool; | |||
public setPassword(#[\SensitiveParameter] string $password): bool; | |||
public statIndex(int $index, int $flags = 0): array|false; | |||
public statName(string $name, int $flags = 0): array|false; | |||
public unchangeAll(): bool; | |||
public unchangeArchive(): bool; | |||
public unchangeIndex(int $index): bool; | |||
public unchangeName(string $name): bool; | |||
} | } | ||
</pre> | </pre> | ||
=== Egenskaper === | === Egenskaper === | ||
* '''lastId''' - | * '''lastId''' - Indexvärde för senast tillagd post (fil eller katalog). Tillgänglig från PHP 8.0.0 och PECL zip 1.18.0. | ||
* '''status''' - Status för arkivet. | * '''status''' - Status för Zip-arkivet. Tillgänglig för stängda arkiv, från PHP 8.0.0 och PECL zip 1.18.0. | ||
* '''statusSys''' - Systemstatus för Zip-arkivet. Tillgänglig för stängda arkiv, från PHP 8.0.0 och PECL zip 1.18.0. | |||
* '''numFiles''' - Antal filer i arkivet | |||
* ''' | * '''filename''' - Filnamn i filsystemet | ||
* '''comment''' - Kommentar för arkivet | |||
* ''' | |||
* ''' | |||
* ''' | |||
=== | === Innehållsförteckning === | ||
* [[ZipArchive::addEmptyDir|ZipArchive::addEmptyDir]] — Lägg till en ny katalog | |||
* [[ZipArchive::addFile|ZipArchive::addFile]] — Lägger till en fil i ett ZIP-arkiv från den angivna sökvägen | |||
* [[ZipArchive::addFromString|ZipArchive::addFromString]] — Lägg till en fil i ett ZIP-arkiv med dess innehåll | |||
* [[ZipArchive::addGlob|ZipArchive::addGlob]] — Lägg till filer från en katalog med hjälp av glob-mönster | |||
* [[ZipArchive::addPattern|ZipArchive::addPattern]] — Lägg till filer från en katalog med hjälp av PCRE-mönster | |||
* [[ZipArchive::clearError|ZipArchive::clearError]] — Rensa statusfelmeddelande, system- och/eller zip-meddelanden | |||
* [[ZipArchive::close|ZipArchive::close]] — Stäng det aktiva arkivet (öppnat eller nyss skapat) | |||
* [[ZipArchive::count|ZipArchive::count]] — Räknar antalet filer i arkivet | |||
* [[ZipArchive::deleteIndex|ZipArchive::deleteIndex]] — Ta bort en post i arkivet genom att använda dess index | |||
* [[ZipArchive::deleteName|ZipArchive::deleteName]] — Ta bort en post i arkivet genom att använda dess namn | |||
* [[ZipArchive::extractTo|ZipArchive::extractTo]] — Extrahera arkivets innehåll | |||
* [[ZipArchive::getArchiveComment|ZipArchive::getArchiveComment]] — Returnerar kommentaren för Zip-arkivet | |||
* [[ZipArchive::getArchiveFlag|ZipArchive::getArchiveFlag]] — Returnerar värdet för ett globalt Zip-arkiv-flagg | |||
* [[ZipArchive::getCommentIndex|ZipArchive::getCommentIndex]] — Returnerar kommentaren för en post med hjälp av index | |||
* [[ZipArchive::getCommentName|ZipArchive::getCommentName]] — Returnerar kommentaren för en post med hjälp av namn | |||
* [[ZipArchive::getExternalAttributesIndex|ZipArchive::getExternalAttributesIndex]] — Hämta externa attribut för en post definierad av index | |||
* [[ZipArchive::getExternalAttributesName|ZipArchive::getExternalAttributesName]] — Hämta externa attribut för en post definierad av namn | |||
* [[ZipArchive::getFromIndex|ZipArchive::getFromIndex]] — Returnerar innehållet för en post genom dess index | |||
* [[ZipArchive::getFromName|ZipArchive::getFromName]] — Returnerar innehållet för en post genom dess namn | |||
* [[ZipArchive::getNameIndex|ZipArchive::getNameIndex]] — Returnerar namnet på en post genom dess index | |||
* [[ZipArchive::getStatusString|ZipArchive::getStatusString]] — Returnerar statusfelmeddelandet, system- och/eller zip-meddelanden | |||
* [[ZipArchive::getStream|ZipArchive::getStream]] — Hämta en filhanterare till posten definierad genom namn (endast läsning) | |||
* [[ZipArchive::getStreamIndex|ZipArchive::getStreamIndex]] — Hämta en filhanterare till posten definierad genom index (endast läsning) | |||
* [[ZipArchive::getStreamName|ZipArchive::getStreamName]] — Hämta en filhanterare till posten definierad genom namn (endast läsning) | |||
* [[ZipArchive::isCompressionMethodSupported|ZipArchive::isCompressionMethodSupported]] — Kontrollera om en komprimeringsmetod stöds av libzip | |||
* [[ZipArchive::isEncryptionMethodSupported|ZipArchive::isEncryptionMethodSupported]] — Kontrollera om en krypteringsmetod stöds av libzip | |||
* [[ZipArchive::locateName|ZipArchive::locateName]] — Returnerar index för posten i arkivet | |||
* [[ZipArchive::open|ZipArchive::open]] — Öppna ett Zip-arkiv | |||
* [[ZipArchive::registerCancelCallback|ZipArchive::registerCancelCallback]] — Registrera en återuppringning för att tillåta avbrytning vid stängning av arkiv | |||
* [[ZipArchive::registerProgressCallback|ZipArchive::registerProgressCallback]] — Registrera en återuppringning för att tillhandahålla uppdateringar vid stängning av arkiv | |||
* [[ZipArchive::renameIndex|ZipArchive::renameIndex]] — Byt namn på en post definierad av index | |||
* [[ZipArchive::renameName|ZipArchive::renameName]] — Byt namn på en post definierad av namn | |||
* [[ZipArchive::replaceFile|ZipArchive::replaceFile]] — Ersätt fil i Zip-arkiv med en given sökväg | |||
* [[ZipArchive::setArchiveComment|ZipArchive::setArchiveComment]] — Sätt kommentaren för ett Zip-arkiv | |||
* [[ZipArchive::setArchiveFlag|ZipArchive::setArchiveFlag]] — Sätt en global flagga för ett Zip-arkiv | |||
* [[ZipArchive::setCommentIndex|ZipArchive::setCommentIndex]] — Sätt kommentaren för en post definierad av index | |||
* [[ZipArchive::setCommentName|ZipArchive::setCommentName]] — Sätt kommentaren för en post definierad av namn | |||
* [[ZipArchive::setCompressionIndex|ZipArchive::setCompressionIndex]] — Sätt komprimeringsmetoden för en post definierad av index | |||
* [[ZipArchive::setCompressionName|ZipArchive::setCompressionName]] — Sätt komprimeringsmetoden för en post definierad av namn | |||
* [[ZipArchive::setEncryptionIndex|ZipArchive::setEncryptionIndex]] — Sätt krypteringsmetoden för en post definierad av index | |||
* [[ZipArchive::setEncryptionName|ZipArchive::setEncryptionName]] — Sätt krypteringsmetoden för en post definierad av namn | |||
* [[ZipArchive::setExternalAttributesIndex|ZipArchive::setExternalAttributesIndex]] — Sätt externa attribut för en post definierad av index | |||
* [[ZipArchive::setExternalAttributesName|ZipArchive::setExternalAttributesName]] — Sätt externa attribut för en post definierad av namn | |||
* [[ZipArchive::setMtimeIndex|ZipArchive::setMtimeIndex]] — Sätt ändringstiden för en post definierad av index | |||
* [[ZipArchive::setMtimeName|ZipArchive::setMtimeName]] — Sätt ändringstiden för en post definierad av namn | |||
* [[ZipArchive::setPassword|ZipArchive::setPassword]] — Sätt lösenord för det aktiva arkivet | |||
* [[ZipArchive::statIndex|ZipArchive::statIndex]] — Hämta detaljer om en post definierad av index | |||
* [[ZipArchive::statName|ZipArchive::statName]] — Hämta detaljer om en post definierad av namn | |||
* [[ZipArchive::unchangeAll|ZipArchive::unchangeAll]] — Ångra alla ändringar i arkivet | |||
* [[ZipArchive::unchangeArchive|ZipArchive::unchangeArchive]] — Återställ alla globala ändringar i arkivet | |||
* [[ZipArchive::unchangeIndex|ZipArchive::unchangeIndex]] — Återställ alla ändringar för en post vid ett givet index | |||
* [[ZipArchive::unchangeName|ZipArchive::unchangeName]] — Återställ alla ändringar för en post med ett givet namn | |||
= Sidslut = | = Sidslut = | ||
Nuvarande version från 17 november 2024 kl. 13.25
Klassen ZipArchive
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.1.0)
Introduktion
Ett filarkiv, komprimerat med Zip.
Klassöversikt
class [[ZipArchive]] implements [[Countable]] {
/* Konstanter */
public const int CREATE;
public const int EXCL;
public const int CHECKCONS;
public const int OVERWRITE;
public const int RDONLY;
public const int FL_NOCASE;
public const int FL_NODIR;
public const int FL_COMPRESSED;
public const int FL_UNCHANGED;
public const int FL_RECOMPRESS;
public const int FL_ENCRYPTED;
public const int FL_OVERWRITE;
public const int FL_LOCAL;
public const int FL_CENTRAL;
public const int FL_ENC_GUESS;
public const int FL_ENC_RAW;
public const int FL_ENC_STRICT;
public const int FL_ENC_UTF_8;
public const int FL_ENC_CP437;
public const int FL_OPEN_FILE_NOW;
public const int CM_DEFAULT;
public const int CM_STORE;
public const int CM_SHRINK;
public const int CM_REDUCE_1;
public const int CM_REDUCE_2;
public const int CM_REDUCE_3;
public const int CM_REDUCE_4;
public const int CM_IMPLODE;
public const int CM_DEFLATE;
public const int CM_DEFLATE64;
public const int CM_PKWARE_IMPLODE;
public const int CM_BZIP2;
public const int CM_LZMA;
public const int CM_LZMA2;
public const int CM_ZSTD;
public const int CM_XZ;
public const int CM_TERSE;
public const int CM_LZ77;
public const int CM_WAVPACK;
public const int CM_PPMD;
public const int ER_OK;
public const int ER_MULTIDISK;
public const int ER_RENAME;
public const int ER_CLOSE;
public const int ER_SEEK;
public const int ER_READ;
public const int ER_WRITE;
public const int ER_CRC;
public const int ER_ZIPCLOSED;
public const int ER_NOENT;
public const int ER_EXISTS;
public const int ER_OPEN;
public const int ER_TMPOPEN;
public const int ER_ZLIB;
public const int ER_MEMORY;
public const int ER_CHANGED;
public const int ER_COMPNOTSUPP;
public const int ER_EOF;
public const int ER_INVAL;
public const int ER_NOZIP;
public const int ER_INTERNAL;
public const int ER_INCONS;
public const int ER_REMOVE;
public const int ER_DELETED;
public const int ER_ENCRNOTSUPP;
public const int ER_RDONLY;
public const int ER_NOPASSWD;
public const int ER_WRONGPASSWD;
public const int ER_OPNOTSUPP;
public const int ER_INUSE;
public const int ER_TELL;
public const int ER_COMPRESSED_DATA;
public const int ER_CANCELLED;
public const int ER_DATA_LENGTH;
public const int ER_NOT_ALLOWED;
public const int AFL_RDONLY;
public const int AFL_IS_TORRENTZIP;
public const int AFL_WANT_TORRENTZIP;
public const int AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE;
public const int OPSYS_DOS;
public const int OPSYS_AMIGA;
public const int OPSYS_OPENVMS;
public const int OPSYS_UNIX;
public const int OPSYS_VM_CMS;
public const int OPSYS_ATARI_ST;
public const int OPSYS_OS_2;
public const int OPSYS_MACINTOSH;
public const int OPSYS_Z_SYSTEM;
public const int OPSYS_CPM;
public const int OPSYS_WINDOWS_NTFS;
public const int OPSYS_MVS;
public const int OPSYS_VSE;
public const int OPSYS_ACORN_RISC;
public const int OPSYS_VFAT;
public const int OPSYS_ALTERNATE_MVS;
public const int OPSYS_BEOS;
public const int OPSYS_TANDEM;
public const int OPSYS_OS_400;
public const int OPSYS_OS_X;
public const int OPSYS_DEFAULT;
public const int EM_NONE;
public const int EM_TRAD_PKWARE;
public const int EM_AES_128;
public const int EM_AES_192;
public const int EM_AES_256;
public const int EM_UNKNOWN;
public const string LIBZIP_VERSION;
public const int LENGTH_TO_END;
public const int LENGTH_UNCHECKED;
/* Egenskaper */
public readonly int $lastId;
public readonly int $status;
public readonly int $statusSys;
public readonly int $numFiles;
public readonly string $filename;
public readonly string $comment;
/* Metoder */
public addEmptyDir(string $dirname, int $flags = 0): bool;
public addFile(string $filepath, string $entryname = "", int $start = 0, int $length = ZipArchive::LENGTH_TO_END, int $flags = ZipArchive::FL_OVERWRITE): bool;
public addFromString(string $name, string $content, int $flags = ZipArchive::FL_OVERWRITE): bool;
public addGlob(string $pattern, int $flags = 0, array $options = []): array|false;
public addPattern(string $pattern, string $path = ".", array $options = []): array|false;
public clearError(): void;
public close(): bool;
public count(): int;
public deleteIndex(int $index): bool;
public deleteName(string $name): bool;
public extractTo(string $pathto, array|string|null $files = null): bool;
public getArchiveComment(int $flags = 0): string|false;
public getArchiveFlag(int $flag, int $flags = 0): int;
public getCommentIndex(int $index, int $flags = 0): string|false;
public getCommentName(string $name, int $flags = 0): string|false;
public getExternalAttributesIndex(int $index, int &$opsys, int &$attr, int $flags = 0): bool;
public getExternalAttributesName(string $name, int &$opsys, int &$attr, int $flags = 0): bool;
public getFromIndex(int $index, int $len = 0, int $flags = 0): string|false;
public getFromName(string $name, int $len = 0, int $flags = 0): string|false;
public getNameIndex(int $index, int $flags = 0): string|false;
public getStatusString(): string;
public getStream(string $name): resource|false;
public getStreamIndex(int $index, int $flags = 0): resource|false;
public getStreamName(string $name, int $flags = 0): resource|false;
public static isCompressionMethodSupported(int $method, bool $enc = true): bool;
public static isEncryptionMethodSupported(int $method, bool $enc = true): bool;
public locateName(string $name, int $flags = 0): int|false;
public open(string $filename, int $flags = 0): bool|int;
public registerCancelCallback(callable $callback): bool;
public registerProgressCallback(float $rate, callable $callback): bool;
public renameIndex(int $index, string $new_name): bool;
public renameName(string $name, string $new_name): bool;
public replaceFile(string $filepath, int $index, int $start = 0, int $length = ZipArchive::LENGTH_TO_END, int $flags = 0): bool;
public setArchiveComment(string $comment): bool;
public setArchiveFlag(int $flag, int $value): bool;
public setCommentIndex(int $index, string $comment): bool;
public setCommentName(string $name, string $comment): bool;
public setCompressionIndex(int $index, int $method, int $compflags = 0): bool;
public setCompressionName(string $name, int $method, int $compflags = 0): bool;
public setEncryptionIndex(int $index, int $method, #[\SensitiveParameter] ?string $password = null): bool;
public setEncryptionName(string $name, int $method, #[\SensitiveParameter] ?string $password = null): bool;
public setExternalAttributesIndex(int $index, int $opsys, int $attr, int $flags = 0): bool;
public setExternalAttributesName(string $name, int $opsys, int $attr, int $flags = 0): bool;
public setMtimeIndex(int $index, int $timestamp, int $flags = 0): bool;
public setMtimeName(string $name, int $timestamp, int $flags = 0): bool;
public setPassword(#[\SensitiveParameter] string $password): bool;
public statIndex(int $index, int $flags = 0): array|false;
public statName(string $name, int $flags = 0): array|false;
public unchangeAll(): bool;
public unchangeArchive(): bool;
public unchangeIndex(int $index): bool;
public unchangeName(string $name): bool;
}
Egenskaper
- lastId - Indexvärde för senast tillagd post (fil eller katalog). Tillgänglig från PHP 8.0.0 och PECL zip 1.18.0.
- status - Status för Zip-arkivet. Tillgänglig för stängda arkiv, från PHP 8.0.0 och PECL zip 1.18.0.
- statusSys - Systemstatus för Zip-arkivet. Tillgänglig för stängda arkiv, från PHP 8.0.0 och PECL zip 1.18.0.
- numFiles - Antal filer i arkivet
- filename - Filnamn i filsystemet
- comment - Kommentar för arkivet
Innehållsförteckning
- ZipArchive::addEmptyDir — Lägg till en ny katalog
- ZipArchive::addFile — Lägger till en fil i ett ZIP-arkiv från den angivna sökvägen
- ZipArchive::addFromString — Lägg till en fil i ett ZIP-arkiv med dess innehåll
- ZipArchive::addGlob — Lägg till filer från en katalog med hjälp av glob-mönster
- ZipArchive::addPattern — Lägg till filer från en katalog med hjälp av PCRE-mönster
- ZipArchive::clearError — Rensa statusfelmeddelande, system- och/eller zip-meddelanden
- ZipArchive::close — Stäng det aktiva arkivet (öppnat eller nyss skapat)
- ZipArchive::count — Räknar antalet filer i arkivet
- ZipArchive::deleteIndex — Ta bort en post i arkivet genom att använda dess index
- ZipArchive::deleteName — Ta bort en post i arkivet genom att använda dess namn
- ZipArchive::extractTo — Extrahera arkivets innehåll
- ZipArchive::getArchiveComment — Returnerar kommentaren för Zip-arkivet
- ZipArchive::getArchiveFlag — Returnerar värdet för ett globalt Zip-arkiv-flagg
- ZipArchive::getCommentIndex — Returnerar kommentaren för en post med hjälp av index
- ZipArchive::getCommentName — Returnerar kommentaren för en post med hjälp av namn
- ZipArchive::getExternalAttributesIndex — Hämta externa attribut för en post definierad av index
- ZipArchive::getExternalAttributesName — Hämta externa attribut för en post definierad av namn
- ZipArchive::getFromIndex — Returnerar innehållet för en post genom dess index
- ZipArchive::getFromName — Returnerar innehållet för en post genom dess namn
- ZipArchive::getNameIndex — Returnerar namnet på en post genom dess index
- ZipArchive::getStatusString — Returnerar statusfelmeddelandet, system- och/eller zip-meddelanden
- ZipArchive::getStream — Hämta en filhanterare till posten definierad genom namn (endast läsning)
- ZipArchive::getStreamIndex — Hämta en filhanterare till posten definierad genom index (endast läsning)
- ZipArchive::getStreamName — Hämta en filhanterare till posten definierad genom namn (endast läsning)
- ZipArchive::isCompressionMethodSupported — Kontrollera om en komprimeringsmetod stöds av libzip
- ZipArchive::isEncryptionMethodSupported — Kontrollera om en krypteringsmetod stöds av libzip
- ZipArchive::locateName — Returnerar index för posten i arkivet
- ZipArchive::open — Öppna ett Zip-arkiv
- ZipArchive::registerCancelCallback — Registrera en återuppringning för att tillåta avbrytning vid stängning av arkiv
- ZipArchive::registerProgressCallback — Registrera en återuppringning för att tillhandahålla uppdateringar vid stängning av arkiv
- ZipArchive::renameIndex — Byt namn på en post definierad av index
- ZipArchive::renameName — Byt namn på en post definierad av namn
- ZipArchive::replaceFile — Ersätt fil i Zip-arkiv med en given sökväg
- ZipArchive::setArchiveComment — Sätt kommentaren för ett Zip-arkiv
- ZipArchive::setArchiveFlag — Sätt en global flagga för ett Zip-arkiv
- ZipArchive::setCommentIndex — Sätt kommentaren för en post definierad av index
- ZipArchive::setCommentName — Sätt kommentaren för en post definierad av namn
- ZipArchive::setCompressionIndex — Sätt komprimeringsmetoden för en post definierad av index
- ZipArchive::setCompressionName — Sätt komprimeringsmetoden för en post definierad av namn
- ZipArchive::setEncryptionIndex — Sätt krypteringsmetoden för en post definierad av index
- ZipArchive::setEncryptionName — Sätt krypteringsmetoden för en post definierad av namn
- ZipArchive::setExternalAttributesIndex — Sätt externa attribut för en post definierad av index
- ZipArchive::setExternalAttributesName — Sätt externa attribut för en post definierad av namn
- ZipArchive::setMtimeIndex — Sätt ändringstiden för en post definierad av index
- ZipArchive::setMtimeName — Sätt ändringstiden för en post definierad av namn
- ZipArchive::setPassword — Sätt lösenord för det aktiva arkivet
- ZipArchive::statIndex — Hämta detaljer om en post definierad av index
- ZipArchive::statName — Hämta detaljer om en post definierad av namn
- ZipArchive::unchangeAll — Ångra alla ändringar i arkivet
- ZipArchive::unchangeArchive — Återställ alla globala ändringar i arkivet
- ZipArchive::unchangeIndex — Återställ alla ändringar för en post vid ett givet index
- ZipArchive::unchangeName — Återställ alla ändringar för en post med ett givet namn
Sidslut
Orginalhemsidan på Engelska :https://www.php.net/manual/en/class.ziparchive.php
PHP
Funktioner
Funktionsreferens
Komprimerings- och arkivtillägg
Zip Funktioner
Det här är en maskinöversättning av PHP-manualen till svenska. Om du hittar fel är vi tacksamma om du rapporterar dem via formuläret som finns på
https://www.linux.se/kontaka-linux-se/
Tack till Datorhjälp Stockholm som har sponsrat Linux.se med webbhotell.