Pclzip Introduction
Pclzip is a powerful compression and decompression zip file PHP class, Pclzip Library can compress and extract zip format (WinZip, PKZIP), and can handle such files, including the production of compressed files, List the contents of the compressed file and unzip the file, and so on.
Simple, easy to use, powerful is my evaluation of it.
Recently in the development of my WordPress plugin Sharelink, in this process, found Pclzip This operation zip file PHP class, had to recommend.
Another reason for the recommendation is that in its source code I found a lewd use of PHP function parameters. Examples are shown below.
Generate ZIP file
Usage One:
Copy Code code as follows:
< PHP
Include_once (' pclzip.lib.php ');
$archive = new Pclzip (' Archive.zip ');
$v _list = $archive->create (' File.txt,data/text.txt,folder ');
if ($v _list = = 0) {
Die ("Error:". $archive->errorinfo (true));
}
?>
Usage Two:
Copy Code code as follows:
< PHP
Include_once (' pclzip.lib.php ');
$archive = new Pclzip (' Archive.zip ');
$v _list = $archive->create (' Data/file.txt,data/text.txt '),
Pclzip_opt_remove_path, ' data ',
Pclzip_opt_add_path, ' install ');
if ($v _list==0) {
Die ("Error:". $archive->errorinfo (true));
}
?>