search
HomeJavajavaTutorialIn PHP, zip_read() function

In PHP, zip_read() function

Aug 31, 2023 pm 04:29 PM
phpfunctionzip_read()

In PHP, zip_read() function

zip_read() function reads the next entry in a ZIP file archive.

Syntax

zip_read(zip)

Parameters

  • zip − The zip resource to be read

Return value

The zip_read() function returns the resource containing the file in the zip archive on success.

Example

The following is an example where we have a zip file named "new.zip" and contains the following files.

amit.txt
peter.txt
result.html
demo.java
settings.ini

Example

Now let’s look at an example:

<?php
   $zip = zip_open("new.zip");
   if ($zip) {
      while ($zip_entry = zip_read($zip)) {
         echo "File Name = ". zip_entry_filename($zip_entry). "<br/>";
      }
      zip_close($zip);
   }
?>

Output

File Name = amit.txt
File Name = peter.txt
File Name = result.html
File Name = demo.java
File Name = settings.ini

The above is the detailed content of In PHP, zip_read() function. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)