Home > Article > Backend Development > zip_entry_read() function in PHP
zip_entry_read() function is used to get the contents from an opened zip archive file.
zip_entry_read(zip_entry, len)
zip_entry - zip entry resource. Required.
#len - Length in bytes. The default value is 1024.
zip_entry_read() function returns the contents of the opened zip archive file. Returns FALSE on failure.
Example The following is an example. Suppose our zip file "one.zip" has only one file, "detail.txt", which contains the following content.
Asia is a continent!
Let’s see an 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); } ?>
Text in the file = Asia is a continent!
The above is the detailed content of zip_entry_read() function in PHP. For more information, please follow other related articles on the PHP Chinese website!