PHPのお勉強! PHP TOP Downloads Documentation Get Involved Help Getting Started Introduction A simple tutorial Language Reference Basic syntax Types Variables Constants Expressions Operators Control Structures Functions Classes and Objects Namespaces Enumerations Errors Exceptions Fibers Generators Attributes References Explained Predefined Variables Predefined Exceptions Predefined Interfaces and Classes Predefined Attributes Context options and parameters Supported Protocols and Wrappers Security Introduction General considerations Installed as CGI binary Installed as an Apache module Session Security Filesystem Security Database Security Error Reporting User Submitted Data Hiding PHP Keeping Current Features HTTP authentication with PHP Cookies Sessions Handling file uploads Using remote files Connection handling Persistent Database Connections Command line usage Garbage Collection DTrace Dynamic Tracing Function Reference Affecting PHP's Behaviour Audio Formats Manipulation Authentication Services Command Line Specific Extensions Compression and Archive Extensions Cryptography Extensions Database Extensions Date and Time Related Extensions File System Related Extensions Human Language and Character Encoding Support Image Processing and Generation Mail Related Extensions Mathematical Extensions Non-Text MIME Output Process Control Extensions Other Basic Extensions Other Services Search Engine Extensions Server Specific Extensions Session Extensions Text Processing Variable and Type Related Extensions Web Services Windows Only Extensions XML Manipulation GUI Extensions Keyboard Shortcuts? This help j Next menu item k Previous menu item g p Previous man page g n Next man page G Scroll to bottom g g Scroll to top g h Goto homepage g s Goto search(current page) / Focus search box ZipArchive::addEmptyDir » « 例 PHP マニュアル 関数リファレンス 圧縮およびアーカイブ Zip Change language: English German Spanish French Italian Japanese Brazilian Portuguese Russian Turkish Ukrainian Chinese (Simplified) Other ZipArchive クラス (PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.1.0) はじめに Zip で圧縮されたファイルアーカイブです。 クラス概要 class ZipArchive implements Countable { /* 定数 */ 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; /* プロパティ */ public readonly int $lastId; public readonly int $status; public readonly int $statusSys; public readonly int $numFiles; public readonly string $filename; public readonly string $comment; /* メソッド */ 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 上にスクロールTOP 技術的MEMO PHP解説 About Us Staff お問い合わせ 世界で一番暑い夏(Nolans)