ฟังก์ชัน zip_read()
ความหมายของฟังก์ชันและการใช้งาน
อ่านไฟล์ซิป ด้วยฟังก์ชัน zip_read()
รูปแบบการเขียน (Syntax)
zip_read(zip)
- zip คือ resource ที่ได้จากการใช้ฟังก์ชัน zip_read()
ตัวอย่าง
<?php
$filezip = zip_open("zipname.zip");
if ($filezip)
{
while ($zip_entry = zip_read($filezip))
{
echo "<p>";
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);
}
echo "</p>";
}
zip_close($filezip);
}
?>
Output
Name: zipname.txt
File Contents:
Hello World! This is a test for a the zip functions in PHP.
Name: htmlziptest.html
File Contents:
Hello World!
This is a test for a the zip functions in PHP.