Unix and Linux Discussions Tagged with zip |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
2 |
2,602 |
UNIX for Beginners Questions & Answers |
|
|
|
3 |
6,478 |
UNIX for Beginners Questions & Answers |
|
|
|
14 |
16,360 |
Ubuntu |
|
|
|
1 |
4,629 |
Shell Programming and Scripting |
|
|
|
5 |
4,497 |
UNIX for Beginners Questions & Answers |
|
|
|
3 |
7,122 |
Ubuntu |
|
|
|
1 |
1,797 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
1,784 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
2,440 |
Shell Programming and Scripting |
|
|
|
1 |
1,965 |
Shell Programming and Scripting |
|
|
|
1 |
2,162 |
Shell Programming and Scripting |
|
|
|
1 |
5,331 |
UNIX for Advanced & Expert Users |
|
|
|
4 |
1,641 |
UNIX for Beginners Questions & Answers |
|
|
|
4 |
15,412 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
1,946 |
Shell Programming and Scripting |
|
|
|
3 |
2,657 |
Shell Programming and Scripting |
|
|
|
3 |
6,890 |
Shell Programming and Scripting |
|
|
|
2 |
2,445 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
6,161 |
Shell Programming and Scripting |
|
|
|
14 |
15,624 |
UNIX for Dummies Questions & Answers |
|
|
|
5 |
3,436 |
Shell Programming and Scripting |
|
|
|
7 |
7,635 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
1,713 |
Shell Programming and Scripting |
|
|
|
6 |
3,583 |
Shell Programming and Scripting |
|
|
|
5 |
4,858 |
Shell Programming and Scripting |
|
|
|
3 |
12,332 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
3,275 |
UNIX for Dummies Questions & Answers |
|
|
|
4 |
9,841 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
2,452 |
Shell Programming and Scripting |
|
|
|
7 |
53,443 |
Shell Programming and Scripting |
|
|
|
3 |
14,340 |
Shell Programming and Scripting |
|
|
|
2 |
13,760 |
Windows & DOS: Issues & Discussions |
|
|
|
4 |
16,445 |
Shell Programming and Scripting |
|
|
|
2 |
42,475 |
UNIX for Advanced & Expert Users |
|
|
|
1 |
10,001 |
Solaris |
|
|
|
3 |
6,320 |
Shell Programming and Scripting |
|
|
|
0 |
963 |
Software Releases - RSS News |
|
|
|
2 |
3,182 |
Shell Programming and Scripting |
|
|
|
4 |
36,174 |
Shell Programming and Scripting |
|
|
|
0 |
1,146 |
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)