PHP zip_entry_read() Function
Definition and Usage
The zip_entry_read() function retrieves the content from the opened zip archive project.
If successful, it returns the content of the item. If it fails, it returns false.
Syntax
zip_entry_read(zip_entry,length)
Parameter | Description |
---|---|
zip_entry | Required. Specifies the zip project resource to be read (the zip project opened by zip_read()). |
length | Optional. Specifies the number of bytes to return. The default is 1024. |
Example
<?php $zip = zip_open("test.zip"); if ($zip) { while ($zip_entry = zip_read($zip)) { echo "<p>"; echo "Name: " . zip_entry_name($zip_entry) . "<br />"; if (zip_entry_open($zip, $zip_entry)) { echo "File Contents:<br/>"; $contents = zip_entry_read($zip_entry); echo "$contents<br />"; zip_entry_close($zip_entry); } echo "</p>"; } zip_close($zip); } ?>