Pclzip makes PHP easy to compress and decompress

Source: Internet
Author: User
Tags zip

Pclzip Introduction
the Pclzip library compresses and compresses zip files (WinZip, pkzip) and can process such files, including producing compressed files, listing the contents of compressed files, and decompressing files. Because of the ability to compress and decompress on the server side of the action, it is quite convenient to use.
Pclzip defines a Pclzip class whose class object can be treated as a zip file and as a method for processing.

Pclzip official Address: http://www.phpconcept.net/pclzip/index.php

Instance Code

<?php
Include_once (' pclzip.lib.php '); Load class file
$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 "compact Success";

}
?>

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.