ฟังก์ชัน zip_read() อ่านรายการถัดไปในไฟล์ ZIP ที่เก็บถาวร
ไวยากรณ์
zip_read(zip)
พารามิเตอร์
-
zip - ทรัพยากร zip เพื่ออ่าน
คืนสินค้า
ฟังก์ชัน zip_read() ส่งคืนทรัพยากรที่มีไฟล์ภายในไฟล์ zip เมื่อสำเร็จ
ตัวอย่าง
ต่อไปนี้เป็นตัวอย่าง ซึ่งเรามีไฟล์ zip "new.zip" โดยมีไฟล์ดังต่อไปนี้
amit.txt peter.txt result.html demo.java settings.ini
ตัวอย่าง
เรามาดูตัวอย่างกัน:
<?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);
}
?> ผลลัพธ์
File Name = amit.txt File Name = peter.txt File Name = result.html File Name = demo.java File Name = settings.ini