2023-09-07

在PHP中的zip_entry_read()函数


在PHP中的zip_entry_read()函数

zip_entry_read() 函数用于从打开的 zip 存档文件中获取内容。

语法

zip_entry_read(zip_entry, len)
登录后复制

参数

  • zip_entry – zip 条目资源。必需。

  • len – 以字节为单位的长度。默认值为 1024。

返回

zip_entry_read() 函数返回打开的 zip 存档文件的内容。失败时返回 FALSE。

示例以下是一个示例。假设我们的 zip 文件“one.zip”只有一个文件,即“detail.txt”,其中包含以下内容。

Asia is a continent!
登录后复制

让我们看一个例子 –

例子

<?php
   $zip_file = zip_open("one.zip");
   if ($zip_file) {
      while ($zip_entry = zip_read($zip)) {
         if (zip_entry_open($zip_file, $zip_entry)) {
            echo "Text in the file = <br/>";
            echo "zip_entry_read($zip_entry)<br />";
            zip_entry_close($zip_entry);
         }
         echo "</p>";
      }
      zip_close($zip_file);
   }
?>
登录后复制

输出

Text in the file =
Asia is a continent!
登录后复制

以上就是在PHP中的zip_entry_read()函数的详细内容,更多请关注php中文网其它相关文章!

https://www.php.cn/faq/603926.html

发表回复

Your email address will not be published. Required fields are marked *