jar file packaging php zip packaging download file

WBOY
Release: 2016-07-28 08:30:19
Original
1470 people have browsed it
<ol>
<li>将文件打包成zip格式</li>
<li>下载文件的功能</li>
</ol><p>要点解析:</p><ol><li>这里我采用的是php自带的ZipArchive类</li></ol><p>    a) 我们只需要new一个ZipArchive对象,然后使用open方法创建一个zip文件,接着使用addFile方法,将要打包的文件写入刚刚创建的zip文件中,最好还得记得关闭该对象。</p><p>    b) 注意点:使用open方法的时候,第二个参数$flags是可选的,$flags用来指定对打开的zip文件的处理方式,共有四种情况</p><p>                    i.     <tt>ZIPARCHIVE::OVERWRITE</tt> 总是创建一个新的文件,如果指定的zip文件存在,则会覆盖掉</p><p>                      ii.    <tt>ZIPARCHIVE::CREATE</tt>     如果指定的zip文件不存在,则新建一个</p><p><tt>              iii.  </tt><tt>ZIPARCHIVE::EXCL      </tt><tt>如果指定的zip文件存在,则会报错   </tt></p><p><tt>               iv.  </tt><tt>ZIPARCHIVE::CHECKCON</tt></p>
Copy after login
rrree

The above introduces jar file packaging, php zip packaging and downloading files, including the contents of jar file packaging. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!