The zip_close() function closes a zip archive opened by the zip_open() function.
PHP zip_close() Function has the following syntax.
zip_close(zip)
Parameter | Is Required | Description |
---|---|---|
zip | Required. | Zip resource to close (a zip file opened with zip_open() ) |
No value is returned.
Close a zip file
<?php
$zip = zip_open("test.zip");
zip_close($zip);
?>
The following code shows how to close a zip archive opened by the zip_entry_open() function.
// w w w.j a va2 s .com
<?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
zip_entry_close($zip_entry);
}
echo "</p>";
}
zip_close($zip);
}
?>