Home > php教程 > php手册 > THINKPHP将本地文件打包成zip下载类

THINKPHP将本地文件打包成zip下载类

WBOY
Release: 2016-06-07 11:43:47
Original
1322 people have browsed it

自己在项目中用的一个类,整合在TP中,可将本地文件打包成zip后下载
用法事例:
将zip包解压后将扩展类FileToZip.class放到ThinkPHP\Extend\Library\ORG\Util文件夹中,import('ORG.Util.FileToZip');<br>         // 打包下载<br>         $handler = opendir($cur_file);    //$cur_file 文件所在目录<br>         $download_file = array();<br>         $i = 0;<br>         while( ($filename = readdir($handler)) !== false ) {<br>             if($filename != '.' && $filename != '..') {<br>                 $download_file[$i++] = $filename;<br>             }<br>         }<br>         closedir($handler);<br>         $scandir=new traverseDir($cur_file,$save_path);    //$save_path zip包文件目录<br>         $scandir->tozip($download_file);

附件 FileToZip.class.rar ( 1.49 KB 下载:708 次 )

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template