Home  >  Article  >  Backend Development  >  zip_entry_read() function in PHP

zip_entry_read() function in PHP

PHPz
PHPzforward
2023-09-07 21:49:021112browse

zip_entry_read() function in PHP

zip_entry_read() function is used to get the contents from an opened zip archive file.

Syntax

zip_entry_read(zip_entry, len)

Parameters

  • zip_entry - zip entry resource. Required.

  • #len - Length in bytes. The default value is 1024.

Return

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 -

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!

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete