From 0231bf902c94140dec00bacb58fddde9d84e3eba Mon Sep 17 00:00:00 2001 From: Daniel Beckham Date: Sat, 2 Jun 2001 06:07:15 +0000 Subject: [PATCH] added missing functions and main example git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@49101 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/zip.xml | 126 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 121 insertions(+), 5 deletions(-) diff --git a/functions/zip.xml b/functions/zip.xml index 6330a30497..5718b8ce0b 100644 --- a/functions/zip.xml +++ b/functions/zip.xml @@ -35,6 +35,31 @@ <?PHP +$zip = zip_open("/tmp/test2.zip"); + +if ($zip) { + + while ($zip_entry = zip_read($zip)) { + echo "Name: " . zip_entry_name($zip_entry) . "\n"; + echo "Actual Filesize: " . zip_entry_filesize($zip_entry) . "\n"; + echo "Compressed Size: " . zip_entry_compressedsize($zip_entry) . "\n"; + echo "Compression Method: " . zip_entry_compressionmethod($zip_entry) . "\n"; + + if (zip_entry_open($zip, $zip_entry, "r")) { + echo "File Contents:\n"; + $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); + echo "$buf\n"; + + zip_entry_close($zip_entry); + } + echo "\n"; + + } + + zip_close($zip); + +} + ?> @@ -72,7 +97,7 @@ zip_close - Close a Zip Entry + Close a Directory Entry Description @@ -101,7 +126,7 @@ zip_entry_compressedsize - Retrive the Compressed Size of a Zip Entry + Retrive the Compressed Size of a Directory Entry Description @@ -127,7 +152,7 @@ zip_entry_compressionmethod - Retrive the Compression Method of a Zip Entry + Retrive the Compression Method of a Directory Entry Description @@ -153,7 +178,7 @@ zip_entry_filesize - Retrive the Actual File Size of a Zip Entry + Retrive the Actual File Size of a Directory Entry Description @@ -179,7 +204,7 @@ zip_entry_name - Retrive the Name of a Zip Entry + Retrive the Name of a Directory Entry Description @@ -202,6 +227,97 @@ + + + zip_entry_open + Open a Directory Entry for Reading + + + Description + + + bool zip_entry_open + resource zip + resource zip_entry + string mode + + + + Opens a directory entry in a zip file for reading. The parameter + zip is a valid resource handle returned by + zip_open. The parameter + zip_entry is a directory entry resource + returned by zip_read. The optional parameter + mode can be any of the modes specified in + the documentaion for fopen. + + + + Currently, mode is ignored and is always + "rb". This is due to the fact that zip + support in PHP is read only access. Please see + fopen for an explanation of various modes, + including "rb". + + + + Returns true on succes or false on failure. + + + + Unlike fopen and other similar functions, + the return value of zip_entry_open only + indicates the result of the operation and is not needed for + reading or closing the directory entry. + + + + See also zip_entry_read and + zip_entry_close. + + + + + + + zip_read + Read From an Open Directory Entry + + + Description + + + string zip_entry_read + resource zip_entry + int length + + + + Reads up to length bytes from an open + directory entry. If length is not + specified, then zip_entry_read will attempt + to read 1024 bytes. The parameter + zip_entry is a valid directory entry + returned by zip_read. + + + + The length parameter should be the + uncompressed length you wish to read. + + + + Returns the data read, or false if the end of + the file is reached. + + + See also zip_entry_open, + zip_entry_close and + zip_entry_filesize. + + + + zip_open