Các hàm Zip của PHP
Giới thiệu về PHP Zip
Các chức năng của tệp Zip cho phép bạn đọc các tệp ZIP.
Yêu cầu
Phần mở rộng ZIP yêu cầu libzip .
Cài đặt
Hệ thống Linux
Để các hàm này hoạt động, bạn phải biên dịch PHP bằng --enable-zip.
PHP 5.6: Sử dụng tùy chọn cấu hình --with-libzip=DIR để sử dụng cài đặt libzip hệ thống. Cần có phiên bản libzip 0.11, khuyến nghị phiên bản 0.11.2 trở lên.
PHP 7.3: Việc xây dựng dựa trên libzip đi kèm không được khuyến khích nhưng vẫn có thể thực hiện được bằng cách thêm --without-libzip vào cấu hình.
Hệ thống Windows
Trước PHP 5.3: Người dùng phải bật "php_zip.dll" bên trong "php.ini" để các chức năng này hoạt động.
Từ PHP 5.3: Tiện ích mở rộng ZIP được tích hợp sẵn.
Các hàm Zip của PHP
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 |