Home  >  Article  >  Backend Development  >  CI框架中zip类应用示例_php实例

CI框架中zip类应用示例_php实例

WBOY
WBOYOriginal
2016-06-07 17:18:56882browse

CI框架自带的zip类简单实用,本文就来简单说一下CI框架的zip类的使用。

首先需要导入zip类:

复制代码 代码如下:

$this->load->('zip');

此外,但是考虑到CI的结构,还需要设置一下自动加载类,把zip加载进去。
可以在设置的时候,统一加载
大家如果遇到这个问题可能就是自动加载没有加载zip类。
具体调用方法如下:

复制代码 代码如下:

$path = $_SERVER['DOCUMENT_ROOT'];//需要压缩的文件夹路径
$this->zip->read_dir($path,FALSE);//开始压缩指定路径的文件夹,清除里面的结构。
$this->zip->download('my_backup.zip');//下载压缩后的的文件。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn