PHP zip_entry_read() 函数
PHP 教程
· 2019-01-30 23:43:48
定义和用法
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.
点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html
Node.js开发实战
[美] Jim R. Wilson / 梅晴光、杜万智、陈琳、纪清华、段鹏飞 / 华中科技大学出版社 / 2018-11-10 / 99.90元
2018年美国亚马逊书店排名第一的Node.js开发教程。 . Node.js是基于Chrome V8引擎的JavaScript运行环境,它采用事件驱动、非阻塞式I/O模型,具有轻量、高效的特点。Node.j s 工作在前端代码与 数据存储层之间,能够提高web应用的工作效率和 响应速度。本书以最新版Node.js 8为基础,从实际案例出发 讲解Node.js的核心工作原理和实用开发技......一起来看看 《Node.js开发实战》 这本书的介绍吧!