(PHP 5 >= 5.2.0, PHP 7, PECL zip >= 1.1.0)
ZipArchive::open — Open a ZIP file archive
public ZipArchive::open ( string $filename [, int $flags ] ) : mixed
Opens a new or existing zip archive for reading, writing or modifying.
Since libzip 1.6.0, a empty file is not a valid archive any longer.
filename
The file name of the ZIP archive to open.
flags
The mode to use to open the archive.
Error codes
Returns true
on success or the error code.
ZipArchive::ER_EXISTS
File already exists.
ZipArchive::ER_INCONS
Zip archive inconsistent.
ZipArchive::ER_INVAL
Invalid argument.
ZipArchive::ER_MEMORY
Malloc failure.
ZipArchive::ER_NOENT
No such file.
ZipArchive::ER_NOZIP
Not a zip archive.
ZipArchive::ER_OPEN
Can't open file.
ZipArchive::ER_READ
Read error.
ZipArchive::ER_SEEK
Seek error.
Example #1 Open and extract
Example #2 Create an archive
Example #3 Create an temporary archive
© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/ziparchive.open.php