As mentioned above, the PclZip method for php to package compressed files. Today, another simpler method is to use ZipArchive to compress files.
As mentioned above, the PclZip method for packaging compressed files in php is another simpler method today. it uses ZipArchive to compress files. This is an extension class of php. it has been supported since php5.2. if you encounter an error while using it, check php. in ini, have you removed the semicolon before extension = php_zip.dll, and then restart Apache to use this class library.
It is very simple to use ZipArchive to compress files. The php official website has provided me with many examples. you can refer to http://www.php.net/manual/zh/class.ziparchive.php, for example:
Open('test.zip ') = TRUE) {// The compressed package test.zip exists later. $ zip-> addFile ('Too. php '); $ zip-> addFile ('test. php '); // upload the too.php and test.php files to the $ zip-> close (); // close echo' OK ';} else {echo 'failed';}?>
The following are some parameter descriptions:
In short, it is more convenient to use ZipArchive for file compression as long as you have php5.2 or later versions. Which of the following operations is faster than PclZip? This Lei Zi has not been tested yet. if you are interested, you can try again and again.