Home  >  Article  >  Backend Development  >  PclZip allows PHP to easily compress and decompress_PHP tutorial

PclZip allows PHP to easily compress and decompress_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 14:52:091029browse

Introduction to PclZip
PclZip library can compress and decompress Zip format compressed files (WinZip, PKZIP); and can process such files, including generating compressed files, listing the contents of compressed files, and decompressing them. Compress files and more. Since compression and decompression can be performed on the server side, it is very convenient to use.
PclZip defines a PclZip category. Its category object can be regarded as a ZIP file and also provides methods for processing.


PclZip official address: http://www.phpconcept.net/pclzip/index.php

Example code

include_once('pclzip.lib.php'); //Load class files
$filename=time().'bnxf.zip';//Compressed file name
$path='../../..'.$_GET['path'];//Files that need to be compressed
$archive = new PclZip($filename);
$v_list = $archive->create($path,PCLZIP_OPT_REMOVE_ALL_PATH,PCLZIP_OPT_ADD_PATH,'bnxf'); //Change the compressed file directory to bnxf
if ($v_list == 0) {
die("Error : ".$archive->errorInfo(true));
}else{
echo "Compression successful";


}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/371684.htmlTechArticlePclZip introduction PclZiplibrary can compress and decompress Zip format compressed files (WinZip, PKZIP); and can compress such files Class files are processed, including generating compressed files, listing the contents of compressed files, and...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn