PHP zip_entry_open()Functions


PHP Zip File 参考手册Complete PHP Zip File Reference Manual

Definition and Usage

The zip_entry_open() function opens a zip archive for reading.

If successful, the function returns TRUE. If it fails, it returns FALSE.

Syntax

zip_entry_open(zip,zip_entry,mode)

Parameters Description
zip Required. Specifies the zip resource to read (the zip file opened by zip_open()).
zip_entry Required. Specifies the zip entry resource to open (the zip entry opened by zip_read()).
mode Optional. Specifies the access type for the zip archive entry.

Note:In PHP 5, mode is ignored and is always "rb". This is because zip support in PHP is read-only.



Example

<?php
$zip = zip_open("test.zip");

if ($zip)
{
while ($zip_entry = zip_read($zip))
{
echo "<p>";
echo "Name: " . zip_entry_name($zip_entry) . "<br />";
if (zip_entry_open($zip, $zip_entry))
{
// some code
}
echo "</p>";
}
zip_close($zip);
}
?>


PHP Zip File 参考手册Complete PHP Zip File Reference Manual Other Extensions