PHP 教程 PHP 表单 PHP 高级教程 PHP 数据库 PHP XML PHP 与 AJAX PHP 参考手册

发布于 2016-11-18 14:37:21 | 65 次阅读 | 评论: 0 | 来源: 网络整理


定义和用法

zip_entry_read() 函数从打开的 zip 档案中获取内容。

如果成功,该函数则返回项目的内容。如果失败,则返回 FALSE。

语法

 zip_entry_read(zip_entry,length) 

参数描述
zip_entry必需。规定要读取的 zip 项目资源(由 zip_read() 打开的 zip 项目)。
length可选。规定返回的字节数(未压缩尺寸)。默认是 1024。


实例

 <?php
 $zip = zip_open("test.zip");

 if ($zip)
 {
 while ($zip_entry = zip_read($zip))
 {
 echo "<p>";
 echo "Name: " . zip_entry_name($zip_entry) . "<br />";

 if (zip_entry_open($zip, $zip_entry))
 {
 echo "File Contents:<br/>";
 $contents = zip_entry_read($zip_entry);
 echo "$contents<br />";
 zip_entry_close($zip_entry);
 }
 echo "</p>";
 }

 zip_close($zip);
 }
 ?> 

代码的输出取决于 zip 档案的内容:

 Name: ziptest.txt
 File Contents:
 Hello World! This is a test for a the zip functions in PHP.

 Name: htmlziptest.html
 File Contents: 

Hello World!

This is a test for a the zip functions in PHP.


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务