Unix and Linux Discussions Tagged with zip |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
2 |
2,402 |
UNIX for Beginners Questions & Answers |
|
|
|
3 |
5,953 |
UNIX for Beginners Questions & Answers |
|
|
|
14 |
13,425 |
Ubuntu |
|
|
|
1 |
4,042 |
Shell Programming and Scripting |
|
|
|
5 |
4,191 |
UNIX for Beginners Questions & Answers |
|
|
|
3 |
5,737 |
Ubuntu |
|
|
|
1 |
1,617 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
1,453 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
2,170 |
Shell Programming and Scripting |
|
|
|
1 |
1,775 |
Shell Programming and Scripting |
|
|
|
1 |
1,767 |
Shell Programming and Scripting |
|
|
|
1 |
4,795 |
UNIX for Advanced & Expert Users |
|
|
|
4 |
1,407 |
UNIX for Beginners Questions & Answers |
|
|
|
4 |
14,593 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
1,841 |
Shell Programming and Scripting |
|
|
|
3 |
2,508 |
Shell Programming and Scripting |
|
|
|
3 |
6,637 |
Shell Programming and Scripting |
|
|
|
2 |
2,167 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
5,864 |
Shell Programming and Scripting |
|
|
|
14 |
14,686 |
UNIX for Dummies Questions & Answers |
|
|
|
5 |
3,248 |
Shell Programming and Scripting |
|
|
|
7 |
7,131 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
1,602 |
Shell Programming and Scripting |
|
|
|
6 |
3,333 |
Shell Programming and Scripting |
|
|
|
5 |
4,662 |
Shell Programming and Scripting |
|
|
|
3 |
12,077 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
2,953 |
UNIX for Dummies Questions & Answers |
|
|
|
4 |
9,122 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
2,370 |
Shell Programming and Scripting |
|
|
|
7 |
52,869 |
Shell Programming and Scripting |
|
|
|
3 |
13,910 |
Shell Programming and Scripting |
|
|
|
2 |
12,829 |
Windows & DOS: Issues & Discussions |
|
|
|
4 |
16,083 |
Shell Programming and Scripting |
|
|
|
2 |
42,212 |
UNIX for Advanced & Expert Users |
|
|
|
1 |
9,752 |
Solaris |
|
|
|
3 |
6,058 |
Shell Programming and Scripting |
|
|
|
0 |
886 |
Software Releases - RSS News |
|
|
|
2 |
3,114 |
Shell Programming and Scripting |
|
|
|
4 |
35,433 |
Shell Programming and Scripting |
|
|
|
0 |
1,090 |
Software Releases - RSS News |
ZIPARCHIVE.OPEN(3) 1 ZIPARCHIVE.OPEN(3)
ZipArchive::open - Open a ZIP file archive
SYNOPSIS
mixed ZipArchive::open (string $filename, [int $flags])
DESCRIPTION
Opens a new zip archive for reading, writing or modifying.
PARAMETERS
o $filename
- The file name of the ZIP archive to open.
o $flags
- The mode to use to open the archive.
o ZipArchive::OVERWRITE
o ZipArchive::CREATE
o ZipArchive::EXCL
o ZipArchive::CHECKCONS
RETURN VALUES
o $Error codes
- Returns TRUE on success or the error code.
o ZipArchive::ER_EXISTS File already exists.
o ZipArchive::ER_INCONS Zip archive inconsistent.
o ZipArchive::ER_INVAL Invalid argument.
o ZipArchive::ER_MEMORY Malloc failure.
o ZipArchive::ER_NOENT No such file.
o ZipArchive::ER_NOZIP Not a zip archive.
o ZipArchive::ER_OPEN Can't open file.
o ZipArchive::ER_READ Read error.
o ZipArchive::ER_SEEK Seek error.
EXAMPLES
Example #1
Open and extract
<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip');
if ($res === TRUE) {
echo 'ok';
$zip->extractTo('test');
$zip->close();
} else {
echo 'failed, code:' . $res;
}
?>
Example #2
Create an archive
<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip', ZipArchive::CREATE);
if ($res === TRUE) {
$zip->addFromString('test.txt', 'file content goes here');
$zip->addFile('data.txt', 'entryname.txt');
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
PHP Documentation Group ZIPARCHIVE.OPEN(3)