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

查看所有标签

Python金融大数据分析

Python金融大数据分析

[德] 伊夫·希尔皮斯科 / 姚军 / 人民邮电出版社 / 2015-12 / CNY 99.00

唯一一本详细讲解使用Python分析处理金融大数据的专业图书;金融应用开发领域从业人员必读。 Python凭借其简单、易读、可扩展性以及拥有巨大而活跃的科学计算社区,在需要分析、处理大量数据的金融行业得到了广泛而迅速的应用,并且成为该行业开发核心应用的首选编程语言。《Python金融大数据分析》提供了使用Python进行数据分析,以及开发相关应用程序的技巧和工具。 《Python金融大......一起来看看 《Python金融大数据分析》 这本书的介绍吧!

html转js在线工具
html转js在线工具

html转js在线工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具