Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> PHP

วิธีอ่านไฟล์เดี่ยวภายใน zip archive ด้วย PHP


เพื่ออ่านไฟล์เดี่ยวภายใน zip archive โค้ดมีดังนี้:

$handle = fopen('zip://test.zip#test.txt', 'r'); $result = ''; while (!feof($handle)) {    $result .= fread($handle, 8192); } fclose($handle); echo $result;

ผลลัพธ์จะเป็นเนื้อหาของไฟล์ zip