zip_entry_read() function in PHP

PHPz
Release: 2023-09-07 21:50:01
forward
1116 people have browsed it

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)
Copy after login

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!
Copy after login

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);
   }
?>
Copy after login

Output

Text in the file =
Asia is a continent!
Copy after login

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!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template