PHP 增加了对 .ZIP 文件的读取功能


Posted in PHP onOctober 09, 2006

This module uses the functions of the ZZIPlib library by Guido Draheim to transparently read ZIP compressed archives and the files inside them.
这个模块使用 ZZIPlib 库(Guido Draheim)来读取 ZIP 压缩文档和里面的文件

Please note that ZZIPlib only provides a subset of functions provided in a full implementation of the ZIP compression algorithm and can only read ZIP file archives. A normal ZIP utility is needed to create the ZIP file archives read by this library.
请注意:这个库只是ZIP所有扩展功能的一个子集,只能读取 ZIP 文档里面的内容。一个普通的 ZIP 环境需要能创建 ZIP 文档

Zip support in PHP is not enabled by default. You will need to use the --with-zip configuration option when compiling PHP to enable zip support. This module requires ZZIPlib version >= 0.10.6.
PHP 没有默认支持 ZIP,你需要使用 --with-zip 配置编译你的 PHP.这个模块需要 ZZPIlib 版本>=0.10.6

Note: Zip support before PHP 4.0.7 is experimental. This section reflects the Zip extension as it exists in PHP 4.0.7 and later.
注意:zip在 4.0.7之前是测试的。这一章写的是 php4.0.7 和以后版本的东西

Example Usage
This example opens a ZIP file archive, reads each file in the archive and prints out its contents. The test2.php archive used in this example is one of the test archives in the ZZIPlib source distribution.

Example 1. Zip Usage Example

<?php

$zip = zip_open("/tmp/test2.zip");

if ($zip) {

while ($zip_entry = zip_read($zip)) {
echo "Name: " . zip_entry_name($zip_entry) . "\n";
echo "Actual Filesize: " . zip_entry_filesize($zip_entry) . "\n";
echo "Compressed Size: " . zip_entry_compressedsize($zip_entry) . "\n";
echo "Compression Method: " . zip_entry_compressionmethod($zip_entry) . "\n";

if (zip_entry_open($zip, $zip_entry, "r")) {
echo "File Contents:\n";
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
echo "$buf\n";

zip_entry_close($zip_entry);
}
echo "\n";

}

zip_close($zip);

}

?> 

PHP 相关文章推荐
PHP base64+gzinflate压缩编码和解码代码
Oct 03 PHP
黑夜路人出的几道php笔试题
Aug 04 PHP
PHP 基本语法格式
Dec 15 PHP
php生成zip压缩文件的方法详解
Jun 09 PHP
PHP开源开发框架ZendFramework使用中常见问题说明及解决方案
Jun 12 PHP
php模拟post提交数据的方法
Feb 12 PHP
php倒计时出现-0情况的解决方法
Jul 28 PHP
PHP实现递归目录的5种方法
Oct 27 PHP
CI框架入门之MVC简单示例
Nov 21 PHP
PHP删除字符串中非字母数字字符方法总结
Jan 20 PHP
PHP call_user_func和call_user_func_array函数的简单理解与应用分析
Nov 25 PHP
TP3.2.3框架使用CKeditor编辑器在页面中上传图片的方法分析
Dec 31 PHP
如何去掉文章里的 html 语法
Oct 09 #PHP
如何分别全角和半角以避免乱码
Oct 09 #PHP
玩转虚拟域名◎+ .
Oct 09 #PHP
桌面中心(四)数据显示
Oct 09 #PHP
桌面中心(一)创建数据库
Oct 09 #PHP
桌面中心(二)数据库写入
Oct 09 #PHP
桌面中心(三)修改数据库
Oct 09 #PHP
You might like
PHP利用COM对象访问SQLServer、Access
2006/10/09 PHP
PHP几个数学计算的内部函数学习整理
2011/08/06 PHP
浅谈PHP的反射API
2017/02/26 PHP
php redis实现对200w用户的即时推送
2017/03/04 PHP
5个最佳的Javascript日期处理类库分享
2012/04/15 Javascript
JavaScript立即执行函数的三种不同写法
2014/09/05 Javascript
JS实现1000以内被3或5整除的数字之和
2016/02/18 Javascript
jQuery实现的表格前端排序功能示例
2017/09/18 jQuery
Js利用console计算代码运行时间的方法示例
2017/09/24 Javascript
bootstrap时间控件daterangepicker使用方法及各种小bug修复
2017/10/25 Javascript
vue.js实现的绑定class操作示例
2018/07/06 Javascript
d3绘制基本的柱形图的实现代码
2018/12/12 Javascript
其实你可以少写点if else与switch(推荐)
2019/01/10 Javascript
微信小程序下拉菜单效果的实例代码
2019/05/14 Javascript
为vue项目自动设置请求状态的配置方法
2019/06/09 Javascript
jQuery实现中奖播报功能(让文本滚动起来) 简单设置数值即可
2020/03/20 jQuery
[48:47]VGJ.S vs NB 2018国际邀请赛小组赛BO2 第一场 8.18
2018/08/19 DOTA
python3使用urllib模块制作网络爬虫
2016/04/08 Python
Python reduce()函数的用法小结
2017/11/15 Python
python 通过字符串调用对象属性或方法的实例讲解
2018/04/21 Python
Python实现矩阵相乘的三种方法小结
2018/07/26 Python
在Python中使用defaultdict初始化字典以及应用方法
2018/10/31 Python
python解析含有重复key的json方法
2019/01/22 Python
Python进阶之使用selenium爬取淘宝商品信息功能示例
2019/09/16 Python
Python dict和defaultdict使用实例解析
2020/03/12 Python
音频处理 windows10下python三方库librosa安装教程
2020/06/20 Python
美国知名运动产品零售商:Foot Locker
2016/07/23 全球购物
英国领先的餐饮折扣俱乐部:Gourmet Society
2020/07/26 全球购物
制药工程专业应届生求职信
2013/09/24 职场文书
农村婚礼证婚词
2014/01/10 职场文书
求职信模板怎么做
2014/01/26 职场文书
四查四看剖析材料
2014/02/14 职场文书
安全生产月宣传标语
2014/10/06 职场文书
2015迎新晚会活动总结
2015/07/16 职场文书
2016年七夕情人节宣传语
2015/11/25 职场文书
vue使用refs获取嵌套组件中的值过程
2022/03/31 Vue.js