PHP zip_entry_read()ฟังก์ชั่น
ตัวอย่าง
เปิดไฟล์ ZIP เปิดรายการไดเร็กทอรีเพื่ออ่าน และอ่านจากรายการไดเร็กทอรีที่เปิดอยู่:
<?php
$zip = zip_open("test.zip");
if ($zip) {
while ($zip_entry = zip_read($zip)) {
echo "<p>Name: " . zip_entry_name($zip_entry) . "<br>";
// Open directory entry for reading
if (zip_entry_open($zip, $zip_entry)) {
echo "File Contents:<br>";
// Read open directory entry
$contents = zip_entry_read($zip_entry);
echo "$contents<br>";
zip_entry_close($zip_entry);
}
echo "</p>";
}
zip_close($zip);
}
?>
ผลลัพธ์ของรหัสขึ้นอยู่กับเนื้อหาของไฟล์ ZIP:
Name: ziptest.txt
File Contents:
Hello World! This is a test.
Name: htmlziptest.html
File Contents:
Hello World!
This is a test for the zip functions in PHP.
ความหมายและการใช้งาน
ฟังก์ชัน zip_entry_read() อ่านจากรายการไดเรกทอรีที่เปิดอยู่
ไวยากรณ์
zip_entry_read(zip_entry, length)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
zip_entry | Required. Specifies the directory entry returned by zip_read() |
length | Optional. Specifies the number of (uncompressed) bytes to return. Default is 1024 |
รายละเอียดทางเทคนิค
คืนมูลค่า: | ข้อมูลอ่านหรือ "" ที่ท้ายไฟล์ FALSE เมื่อล้มเหลว |
---|---|
รุ่น PHP: | 4.1.0+ |
❮ PHP Zip อ้างอิง