Getting Started with Pclzip

Source: Internet
Author: User



Getting started with Pclzip
 pclzip::P clzip (): Class creator #实例化类
 pclzip::create (): Create The PKZIP file and add files or folders #创建压缩文件
 pclzip::listcontent (): List content of an archive #获取压缩文件内容列表
 pclzip::extract (): Extract All or part of the content of the archive #解压文件/partial files
 pclzip::p roperties (): Get Properties of the archive #获取压缩文件信息
 Pclzip::add (): Get Properties of the archive #向压缩文件内添加内容 (incorrectly written on the website)
 pclzip::d elete (): Delete files inside the archive #删除压缩文件内文件
 Pclzip::merge (): ADD One archive content in a second archive #合并压缩文件
 pclzip::d uplicate (): Duplicate The archive #复制压缩文件

Instance one, create the compressed file:

include_once (' pclzip.lib.php ');
$archive= newPclzip(' Archive.zip ');
$v _list= $archive -Create(' File.txt,data/text.txt,folder ');
if ($v _list== 0) {
Die ("Error:".$archive -errorinfo(true));
}

Example two, unzip the file:
require_once (' pclzip.lib.php ');
$archive= newPclzip(' Archive.zip ');
if ($archive -Extract() == 0) {
Die ("Error:".$archive -errorinfo(true));
}


Example three, unzip some files:
require_once (' pclzip.lib.php ');
$archive= newPclzip(' Archive.zip ');
if ($archive -Extract(Pclzip_opt_by_name, $fiel _list) = =0) {
Die ("Error:".$archive -errorinfo(true));
}



Example four, get a list of compressed files:
include_once (' pclzip.lib.php ');
$zip= newPclzip("Test.zip");
if (($list= $zip -listcontent()) == 0) {
Die ("Error:".$zip -errorinfo(true));
}For ($i=0; $i<sizeof($list); $i++) {
for (Reset($list[$i]); $key= Key($list[$i]); Next($list[$i])) {
Echo"File $i/[$key] =".$list[$i][$key]."" ;
}
echo ""; }



Reference: HTTP://WWW.PHPCONCEPT.NET/PCLZIP/USER-GUIDE/21

Getting Started with Pclzip

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.