Unix and Linux Discussions Tagged with zip |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
2 |
2,073 |
UNIX for Beginners Questions & Answers |
|
|
|
3 |
5,223 |
UNIX for Beginners Questions & Answers |
|
|
|
14 |
10,895 |
Ubuntu |
|
|
|
1 |
3,638 |
Shell Programming and Scripting |
|
|
|
5 |
3,791 |
UNIX for Beginners Questions & Answers |
|
|
|
3 |
4,574 |
Ubuntu |
|
|
|
1 |
1,260 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
1,047 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
1,944 |
Shell Programming and Scripting |
|
|
|
1 |
1,555 |
Shell Programming and Scripting |
|
|
|
1 |
1,417 |
Shell Programming and Scripting |
|
|
|
1 |
4,318 |
UNIX for Advanced & Expert Users |
|
|
|
4 |
1,183 |
UNIX for Beginners Questions & Answers |
|
|
|
4 |
13,884 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
1,693 |
Shell Programming and Scripting |
|
|
|
3 |
2,316 |
Shell Programming and Scripting |
|
|
|
3 |
6,279 |
Shell Programming and Scripting |
|
|
|
2 |
1,865 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
5,501 |
Shell Programming and Scripting |
|
|
|
14 |
13,923 |
UNIX for Dummies Questions & Answers |
|
|
|
5 |
2,936 |
Shell Programming and Scripting |
|
|
|
7 |
6,659 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
1,457 |
Shell Programming and Scripting |
|
|
|
6 |
2,988 |
Shell Programming and Scripting |
|
|
|
5 |
4,391 |
Shell Programming and Scripting |
|
|
|
3 |
11,880 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
2,792 |
UNIX for Dummies Questions & Answers |
|
|
|
4 |
8,645 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
2,227 |
Shell Programming and Scripting |
|
|
|
7 |
52,157 |
Shell Programming and Scripting |
|
|
|
3 |
13,619 |
Shell Programming and Scripting |
|
|
|
2 |
12,081 |
Windows & DOS: Issues & Discussions |
|
|
|
4 |
15,581 |
Shell Programming and Scripting |
|
|
|
2 |
41,800 |
UNIX for Advanced & Expert Users |
|
|
|
1 |
9,547 |
Solaris |
|
|
|
3 |
5,837 |
Shell Programming and Scripting |
|
|
|
0 |
805 |
Software Releases - RSS News |
|
|
|
2 |
2,952 |
Shell Programming and Scripting |
|
|
|
4 |
34,658 |
Shell Programming and Scripting |
|
|
|
0 |
1,003 |
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)