ฟังก์ชันPHP Zip
PHP Zip Introduction
ฟังก์ชันไฟล์ Zip ช่วยให้คุณอ่านไฟล์ ZIP ได้
ความต้องการ
นามสกุล ZIP ต้องใช้ libzip
การติดตั้ง
ระบบลินุกซ์
เพื่อให้ฟังก์ชันเหล่านี้ใช้งานได้ คุณต้องคอมไพล์ PHP ด้วย --enable-zip
PHP 5.6:ใช้ตัวเลือก --with-libzip=DIRกำหนดค่าเพื่อใช้การติดตั้ง libzip ของระบบ ต้องใช้ libzip เวอร์ชัน 0.11 โดยแนะนำให้ใช้ 0.11.2 หรือใหม่กว่า
PHP 7.3:เราไม่แนะนำให้สร้างจาก libzip ที่แถมมา แต่ก็ยังทำได้โดยการเพิ่ม --without-libzip ให้กับการกำหนดค่า
ระบบ Windows
ก่อน PHP 5.3:ผู้ใช้ต้องเปิดใช้งาน "php_zip.dll" ภายใน "php.ini" เพื่อให้ฟังก์ชันเหล่านี้ทำงานได้
จาก PHP 5.3:มีส่วนขยาย ZIP ในตัว
ฟังก์ชัน PHP Zip
Function | Description |
---|---|
zip_close() | Closes a ZIP file archive |
zip_entry_close() | Closes a ZIP directory entry |
zip_entry_compressedsize() | Returns the compressed file size of a ZIP directory entry |
zip_entry_compressionmethod() | Returns the compression method of a ZIP directory entry |
zip_entry_filesize() | Returns the actual file size of a ZIP directory entry |
zip_entry_name() | Returns the name of a ZIP directory entry |
zip_entry_open() | Opens a directory entry in a ZIP file for reading |
zip_entry_read() | Reads from an open directory entry in the ZIP file |
zip_open() | Opens a ZIP file archive |
zip_read() | Reads the next file in a open ZIP file archive |