PHP zip_entry_read() Function

Description

The zip_entry_read() function gets the contents from a open zip archive entry.

Syntax

PHP zip_entry_read() Function has the following syntax.

zip_entry_read(zip_entry,length)

Parameter

ParameterIs requiredDescription
zip_entryRequired.Zip entry resource to read (a zip entry opened with zip_read() )
lengthOptional.Number of bytes (uncompressed size) to return. Default is 1024

Return

This function returns the content of the entry on success, or FALSE on failure.

Example

Get the contents from a open zip archive entry.


<?php/*from w ww .  jav a  2  s.c om*/
$zip = zip_open("test.zip");

if ($zip){
    while ($zip_entry = zip_read($zip)){
        echo "Name: " . zip_entry_name($zip_entry) . "\n";
        if (zip_entry_open($zip, $zip_entry)){
           $contents = zip_entry_read($zip_entry);
           echo "$contents\n";
           zip_entry_close($zip_entry);
        }
    }
    zip_close($zip);
}
?>




















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions