Php package compressed files: ZipArchive method usage analysis _ php skills

Source: Internet
Author: User
As mentioned above, the PclZip method for php to package compressed files. Today, another simpler method is to use ZipArchive to compress files.

As mentioned above, the PclZip method for packaging compressed files in php is another simpler method today. it uses ZipArchive to compress files. This is an extension class of php. it has been supported since php5.2. if you encounter an error while using it, check php. in ini, have you removed the semicolon before extension = php_zip.dll, and then restart Apache to use this class library.

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:


 Open('test.zip ') = TRUE) {// The compressed package test.zip exists later. $ zip-> addFile ('Too. php '); $ zip-> addFile ('test. php '); // upload the too.php and test.php files to the $ zip-> close (); // close echo' OK ';} else {echo 'failed';}?>


The following are some parameter descriptions:


 


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.

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.