Archive. php, for example: 01? Php02$zipnewziparchive;initialize this class 03if(unzip zip-open(test.zip) TRUE ){
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: 01? Php 02 $ zip = new ZipArchive; // first instantiate this class 03 if ($ zip-open ('test.zip ') === TRUE ){
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:
02 |
$zip = new ZipArchive; // Instantiate this class first |
03 |
if ( $zip ->open( 'test.zip' ) === TRUE) { // The compressed file test.zip is available later. |
04 |
$zip ->addFile( 'too.php' ); |
05 |
$zip ->addFile( 'test.php' ); // Upload the too.php and test.php files to the test.zip package. |
06 |
$zip ->close(); // Close |
The following are some parameter descriptions:
Show source code printing help
03 |
/******** Optional ziparchive parameter *******/ |
05 |
1.ZipArchive::addEmptyDir |
07 |
Add a new file directory |
11 |
Add the file to the specified zip package. |
13 |
3.ZipArchive::addFromString |
15 |
Add the content to the added file at the same time. |
21 |
5.ZipArchive::extractTo |
23 |
Decompress the package |
29 |
7.ZipArchive::getStatusString |
31 |
Returns the status content during compression, including error information and compression information. |
33 |
8.ZipArchive::deleteIndex |
35 |
Delete a file in the compressed package, for example, deleteIndex (0). Delete the first file. |
37 |
9.ZipArchive::deleteName |
39 |
Delete a file name in the package and delete the file. |
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.