What is zip entry read in PHP

In this article I am going to explain about zip_entry_read function in PHP.
  • 2336

PHP zip_entry_read function

The PHP zip_entry_read function is used to get the content from a open zip archive entry. This function returns the content of entry on success.

Syntax of zip_entry_read function

zip_entry_read(ZipEntry, length)

Parameters in zip_entry_read function

It have two parameter:

Parameter Description
ZipEntry It specifies zip entry resource to read.
length It specifies the no of bytes to return.

Example of PHP zip_entry_read function

<?php

$Zip = zip_open("zipfile.zip");

if ($Zip)

 {

 while ($zip_entry = zip_read($Zip))

 {

 echo "Name: " . zip_entry_name($zip_entry) . "<br />";

 if (zip_entry_open($Zip, $zip_entry))

 {

 echo "File Contents:<br/>";

 $Contents = zip_entry_read($zip_entry);

 echo "$Contents<br />";

 zip_entry_close($zip_entry);

 }

 }

 zip_close($zip);

}

?>


Output:

zip-entry-read-php.jpg

You may also want to read these related articles :
here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.