CI framework comes with a simple and practical zip class, this article to briefly describe the use of the CI framework zip class, the need for friends can refer to the next
CI framework comes with a simple and practical zip class, this article is to briefly describe the use of the CI framework zip class.
First you need to import the Zip class:
$this->load-> (' Zip ');
In addition, however, given the structure of CI, it is necessary to set up the auto-load class and load the zip into it.
It can also be loaded uniformly at the time of Setup .
If you encounter this problem it is possible that automatic loading does not load the Zip class.
The specific invocation method is as follows:
$path = $_server[' document_root '];//need to compress the folder path $this->zip->read_dir ($path, FALSE);//Start compressing the folder of the specified path and clear the structure inside. $this->zip->download (' my_backup.zip ');//Download the compressed file.
The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!