PHP implementation of the Web site files bulk compression download function,
The PHP implementation of the file bulk compression package download, this process will be used to ziparchive this class, note that before using this class, Linux needs to turn on Zlib,windows to cancel the Php_zip.dll before the comments. A simple example of compressing a file into a zip format is given below. For specific usage, please consult the relevant PHP documentation.
<?php $filename = ' test.zip '; The resulting file name (with path) if (File_exists ($filename)) { unlink ($filename);}//Regenerate the file $zip =new ziparchive (); if ($zip Open ($filename, ziparchive::create)!==true) { exit (' cannot open file, or file creation failed ')} $datalist =array (' try.php ', ' Zip_ Class.php '); foreach ($datalist as $val) { if (file_exists ($val)) { $zip->addfile ($val); }} $zip->close ();//Close If (!file_exists ($filename)) {
The above is the PHP implementation of the file bulk compression package Download all content, we can also use PHP to invoke the Linux system shell script to achieve this function, this is a thought, I hope you can study.
http://www.bkjia.com/PHPjc/1065566.html www.bkjia.com true http://www.bkjia.com/PHPjc/1065566.html techarticle PHP Implementation of the Web site files bulk compression download function, the use of PHP implementation of the file bulk compression package download, the process will be used to ziparchive this class, note that before using the class, Li ...