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://www.codercto.com/courses/l/5.html

查看所有标签

增长黑客

增长黑客

范冰 / 电子工业出版社 / 2015-7-1 / CNY 59.00

“增长黑客”这一概念近年来兴起于美国互联网创业圈,最早是由互联网创业者Sean Ellis提出。增长黑客是介于技术和市场之间的新型团队角色,主要依靠技术和数据的力量来达成各种营销目标,而非传统意义上靠砸钱来获取用户的市场推广角色。他们能从单线思维者时常忽略的角度和难以企及的高度通盘考虑影响产品发展的因素,提出基于产品本身的改造和开发策略,以切实的依据、低廉的成本、可控的风险来达成用户增长、活跃度上......一起来看看 《增长黑客》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

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

html转js在线工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试