Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
zip_entry_read() function in PHP
The zip_entry_read() function is used to get the contents from an open zip archive file.
Syntax
zip_entry_read(zip_entry, len)
Parameters
zip_entry − The zip entry resource. Required.
len − The length in bytes. The default is 1024.
Return
The zip_entry_read() function Returns the contents from an open zip archive file. Returns FALSE on failure.
ExampleThe following is an example. Let’s say our zip file "one.zip" is having only a single file i.e. "detail.txt" with the following content.
Asia is a continent!
Let us see an example −
Example
<?php
$zip_file = zip_open("one.zip");
if ($zip_file) {
while ($zip_entry = zip_read($zip)) {
if (zip_entry_open($zip_file, $zip_entry)) {
echo "Text in the file = <br/>";
echo "zip_entry_read($zip_entry)<br />";
zip_entry_close($zip_entry);
}
echo "</p>";
}
zip_close($zip_file);
}
?>
Output
Text in the file = Asia is a continent!
Advertisements
