From 5564d5b2202f2287606511f384335a9d6e48056a Mon Sep 17 00:00:00 2001
From: Luffy <52o@qq52o.cn>
Date: Fri, 22 May 2026 10:58:48 +0800
Subject: [PATCH] ext/zip: Change to
---
reference/zip/book.xml | 8 ++---
reference/zip/configure.xml | 22 +++++++-------
reference/zip/constants.xml | 6 ++--
reference/zip/examples.xml | 8 ++---
reference/zip/functions/zip-close.xml | 14 ++++-----
reference/zip/functions/zip-entry-close.xml | 14 ++++-----
.../functions/zip-entry-compressedsize.xml | 14 ++++-----
.../functions/zip-entry-compressionmethod.xml | 14 ++++-----
.../zip/functions/zip-entry-filesize.xml | 14 ++++-----
reference/zip/functions/zip-entry-name.xml | 14 ++++-----
reference/zip/functions/zip-entry-open.xml | 30 +++++++++----------
reference/zip/functions/zip-entry-read.xml | 22 +++++++-------
reference/zip/functions/zip-open.xml | 14 ++++-----
reference/zip/functions/zip-read.xml | 14 ++++-----
reference/zip/setup.xml | 14 ++++-----
reference/zip/ziparchive.xml | 18 +++++------
reference/zip/ziparchive/clearerror.xml | 11 +++----
reference/zip/ziparchive/extractto.xml | 28 ++++++++---------
reference/zip/ziparchive/getarchiveflag.xml | 30 +++++++++----------
reference/zip/ziparchive/setarchiveflag.xml | 22 +++++++-------
20 files changed, 166 insertions(+), 165 deletions(-)
diff --git a/reference/zip/book.xml b/reference/zip/book.xml
index 11556d1b1..580a8bd9b 100644
--- a/reference/zip/book.xml
+++ b/reference/zip/book.xml
@@ -1,7 +1,7 @@
-
-
+
+
Zip
@@ -9,9 +9,9 @@
&reftitle.intro;
-
+
此扩展能够透明地读取或写入 ZIP 压缩档案及其中的文件。
-
+
diff --git a/reference/zip/configure.xml b/reference/zip/configure.xml
index f6ce29345..00dc547f9 100644
--- a/reference/zip/configure.xml
+++ b/reference/zip/configure.xml
@@ -1,41 +1,41 @@
-
+
&reftitle.install;
Linux 系统
-
+
必须在编译 PHP 时用
配置选项来提供 zip 支持来使用这些方法。
-
-
+
+
PHP 7.4.0 之前,PHP 捆绑了 libzip,编译扩展需要使用
配置项。从 PHP 7.3.0 开始, 不鼓励使用捆绑的 libzip
进行构建,但仍然可以使用 配置项。
-
-
+
+
新增 配置选项以使用系统
libzip 安装。需要 libzip 版本 0.11,推荐使用 0.11.2 或更高版本。
-
+
Windows
-
+
从 PHP 8.2.0 开始,必须在 &php.ini; 中启用
php_zip.dll DLL。以前内置此扩展。
-
+
通过 PECL 安装
-
+
&pecl.info;
&url.pecl.package;zip.
-
+
diff --git a/reference/zip/constants.xml b/reference/zip/constants.xml
index 167ec344d..f7a94db2c 100644
--- a/reference/zip/constants.xml
+++ b/reference/zip/constants.xml
@@ -1,15 +1,15 @@
-
+
&reftitle.constants;
&extension.constants;
-
+
ZipArchive 使用类常量。有各种类型的常量,主要有:Flag(以 FL_
为前缀)、全局 Flag(以 AFL_ 为前缀)、错误(以 ER_ 为前缀)以及模式(没有前缀)。
-
+
归档打开模式
diff --git a/reference/zip/examples.xml b/reference/zip/examples.xml
index d7bf04cde..df6b4d30e 100644
--- a/reference/zip/examples.xml
+++ b/reference/zip/examples.xml
@@ -1,7 +1,7 @@
-
-
+
+
&reftitle.examples;
@@ -79,10 +79,10 @@ print_r($odt_meta);
]]>
-
+
此例使用了旧的 API(PHP 4),它打开了 ZIP 文件归档,读取归档里的每个文件,并输出文件内容。此例用到的
test2.zip 文档是 ZZIPlib 源分布里测试文档中的一个。
-
+
Zip 使用范例
diff --git a/reference/zip/functions/zip-close.xml b/reference/zip/functions/zip-close.xml
index 7e37105ef..17d4fd0e7 100644
--- a/reference/zip/functions/zip-close.xml
+++ b/reference/zip/functions/zip-close.xml
@@ -1,6 +1,6 @@
-
+
@@ -19,9 +19,9 @@
voidzip_close
resourcezip
-
+
关闭一个指定的ZIP档案文件。
-
+
&reftitle.parameters;
@@ -30,9 +30,9 @@
zip
-
+
一个由zip_open打开的ZIP文件资源。
-
+
@@ -40,9 +40,9 @@
&reftitle.returnvalues;
-
+
&return.void;
-
+
diff --git a/reference/zip/functions/zip-entry-close.xml b/reference/zip/functions/zip-entry-close.xml
index 906af1c3e..5c73a3190 100644
--- a/reference/zip/functions/zip-entry-close.xml
+++ b/reference/zip/functions/zip-entry-close.xml
@@ -1,6 +1,6 @@
-
+
@@ -19,9 +19,9 @@
boolzip_entry_close
resourcezip_entry
-
+
关闭指定的目录项。
-
+
&reftitle.parameters;
@@ -30,9 +30,9 @@
zip_entry
-
+
一个由zip_entry_open打开的项目。
-
+
@@ -40,9 +40,9 @@
&reftitle.returnvalues;
-
+
&return.success;
-
+
diff --git a/reference/zip/functions/zip-entry-compressedsize.xml b/reference/zip/functions/zip-entry-compressedsize.xml
index 649028675..c1b228342 100644
--- a/reference/zip/functions/zip-entry-compressedsize.xml
+++ b/reference/zip/functions/zip-entry-compressedsize.xml
@@ -1,6 +1,6 @@
-
+
@@ -19,9 +19,9 @@
intfalsezip_entry_compressedsize
resourcezip_entry
-
+
返回指定目录项压缩过后的大小。
-
+
&reftitle.parameters;
@@ -30,9 +30,9 @@
zip_entry
-
+
由函数zip_read 返回的目录项。
-
+
@@ -40,9 +40,9 @@
&reftitle.returnvalues;
-
+
压缩后的大小,&return.falseforfailure;。
-
+
diff --git a/reference/zip/functions/zip-entry-compressionmethod.xml b/reference/zip/functions/zip-entry-compressionmethod.xml
index 208e8ed4c..4732668cd 100644
--- a/reference/zip/functions/zip-entry-compressionmethod.xml
+++ b/reference/zip/functions/zip-entry-compressionmethod.xml
@@ -1,6 +1,6 @@
-
+
@@ -19,9 +19,9 @@
stringfalsezip_entry_compressionmethod
resourcezip_entry
-
+
返回由函数zip_entry确定的目录实体的压缩方法。
-
+
&reftitle.parameters;
@@ -30,9 +30,9 @@
zip_entry
-
+
由函数zip_read 返回的目录实体。
-
+
@@ -40,9 +40,9 @@
&reftitle.returnvalues;
-
+
压缩方法,&return.falseforfailure;。
-
+
diff --git a/reference/zip/functions/zip-entry-filesize.xml b/reference/zip/functions/zip-entry-filesize.xml
index 1a0e6ac0c..59ae0239c 100644
--- a/reference/zip/functions/zip-entry-filesize.xml
+++ b/reference/zip/functions/zip-entry-filesize.xml
@@ -1,6 +1,6 @@
-
+
@@ -19,9 +19,9 @@
intfalsezip_entry_filesize
resourcezip_entry
-
+
返回指定目录实体的实际大小。
-
+
&reftitle.parameters;
@@ -30,9 +30,9 @@
zip_entry
-
+
由函数zip_read 返回的目录实体。
-
+
@@ -40,9 +40,9 @@
&reftitle.returnvalues;
-
+
返回该目录实体的大小,&return.falseforfailure;。
-
+
diff --git a/reference/zip/functions/zip-entry-name.xml b/reference/zip/functions/zip-entry-name.xml
index 267b3c73b..f793d3efb 100644
--- a/reference/zip/functions/zip-entry-name.xml
+++ b/reference/zip/functions/zip-entry-name.xml
@@ -1,6 +1,6 @@
-
+
@@ -19,9 +19,9 @@
stringfalsezip_entry_name
resourcezip_entry
-
+
返回指定目录项的名称。
-
+
&reftitle.parameters;
@@ -30,9 +30,9 @@
zip_entry
-
+
由函数zip_read 返回的目录项。
-
+
@@ -40,9 +40,9 @@
&reftitle.returnvalues;
-
+
目录项的名称,&return.falseforfailure;。
-
+
diff --git a/reference/zip/functions/zip-entry-open.xml b/reference/zip/functions/zip-entry-open.xml
index c78036e82..3af688875 100644
--- a/reference/zip/functions/zip-entry-open.xml
+++ b/reference/zip/functions/zip-entry-open.xml
@@ -1,6 +1,6 @@
-
+
@@ -21,9 +21,9 @@
resourcezip_entry
stringmode"rb"
-
+
打开ZIP文件中的目录实体以便后续读取。
-
+
&reftitle.parameters;
@@ -32,30 +32,30 @@
zip_dp
-
+
由函数zip_open返回的有效的资源句柄。
-
+
zip_entry
-
+
由函数zip_read返回的目录实体。
-
+
mode
-
+
任何在fopen处理文档中指定的模式。
-
+
-
+
由于ZIP在PHP中只支持读取模式,所以mode
实际上总是被设置为"rb"(其他模式会被忽略)。
-
+
@@ -64,14 +64,14 @@
&reftitle.returnvalues;
-
+
&return.success;
-
+
-
+
与fopen和其他类似的方法不同,zip_entry_open
的返回值只用于标示该操作结果,不需要读取或关闭该目录实体。
-
+
diff --git a/reference/zip/functions/zip-entry-read.xml b/reference/zip/functions/zip-entry-read.xml
index d598051b6..76713d7d7 100644
--- a/reference/zip/functions/zip-entry-read.xml
+++ b/reference/zip/functions/zip-entry-read.xml
@@ -1,6 +1,6 @@
-
+
@@ -20,9 +20,9 @@
resourcezip_entry
intlen1024
-
+
读取一个打开了的压缩目录实体。
-
+
&reftitle.parameters;
@@ -31,21 +31,21 @@
zip_entry
-
+
由函数zip_read 返回的目录实体。
-
+
len
-
+
需要返回的字节数。
-
+
-
+
这字节数应该是你所要读取的未压缩的字节数。
-
+
@@ -79,10 +79,10 @@
&reftitle.returnvalues;
-
+
成功的时候返回读取到的数据;到达文件末尾的时候返回一个空的字符串;
读取出错的时候则会返回&false;
-
+
&reftitle.seealso;
diff --git a/reference/zip/functions/zip-open.xml b/reference/zip/functions/zip-open.xml
index fd63f4a3f..7846d7c0c 100644
--- a/reference/zip/functions/zip-open.xml
+++ b/reference/zip/functions/zip-open.xml
@@ -1,6 +1,6 @@
-
+
@@ -19,9 +19,9 @@
resourceintfalsezip_open
stringfilename
-
+
打开一个新的ZIP归档文件进行读取。
-
+
&reftitle.parameters;
@@ -30,9 +30,9 @@
filename
-
+
待打开ZIP归档的文件名。
-
+
@@ -40,10 +40,10 @@
&reftitle.returnvalues;
-
+
成功的时候返回资源句柄供 zip_read 和 zip_close 后续使用;如果
filename 文件不存在或者出现其他错误,则会返回 &false; 或相应的错误码。
-
+
diff --git a/reference/zip/functions/zip-read.xml b/reference/zip/functions/zip-read.xml
index 7b648bb16..e7e5a966a 100644
--- a/reference/zip/functions/zip-read.xml
+++ b/reference/zip/functions/zip-read.xml
@@ -1,6 +1,6 @@
-
+
@@ -19,9 +19,9 @@
resourcefalsezip_read
resourcezip
-
+
读取 ZIP 文件归档中下一项。
-
+
&reftitle.parameters;
@@ -30,9 +30,9 @@
zip
-
+
一个ZIP压缩文件,该ZIP归档文件之前应由函数 zip_open 打开。
-
+
@@ -40,11 +40,11 @@
&reftitle.returnvalues;
-
+
成功的时候返回该当前实体资源供zip_entry_... 系列函数后续使用;
如果没有更多的读取项,则会返回 &false;
如果遇到错误则会返回相应的错误码。
-
+
diff --git a/reference/zip/setup.xml b/reference/zip/setup.xml
index 3db2ada5b..cc8eb90ea 100644
--- a/reference/zip/setup.xml
+++ b/reference/zip/setup.xml
@@ -1,6 +1,6 @@
-
+
&reftitle.setup;
@@ -8,12 +8,12 @@
&reftitle.required;
-
+
此扩展需要 libzip。在 7.3 及其以前的版本,1.1.2 版本都捆绑在 PHP 中。
-
-
+
+
最低支持版本为 0.11,但强烈建议使用更高版本。
-
+
加密支持需要版本 1.2,参阅 ZipArchive::setEncryptionIndex
@@ -31,9 +31,9 @@
&reftitle.resources;
-
+
在 Zip 模块里用到两种资源类型。第一种是 Zip 文档的 Zip 目录,第二种是文档条目的 Zip 条目。
-
+
diff --git a/reference/zip/ziparchive.xml b/reference/zip/ziparchive.xml
index 88429f5c3..046c11f14 100644
--- a/reference/zip/ziparchive.xml
+++ b/reference/zip/ziparchive.xml
@@ -1,6 +1,6 @@
-
+
ZipArchive 类
@@ -11,9 +11,9 @@
&reftitle.intro;
-
+
用 Zip 压缩的文件归档。
-
+
@@ -747,37 +747,37 @@
lastId
- 最后新增的条目(文件或目录)索引值。 从 PHP 8.0.0 和 PECL zip 1.18.0 开始可用。
+ 最后新增的条目(文件或目录)索引值。 从 PHP 8.0.0 和 PECL zip 1.18.0 开始可用。
status
- Zip 归档的状态。从 PHP 8.0.0 和 PECL zip 1.18.0 开始,可用于关闭归档。
+ Zip 归档的状态。从 PHP 8.0.0 和 PECL zip 1.18.0 开始,可用于关闭归档。
statusSys
- Zip 归档的系统状态。从 PHP 8.0.0 和 PECL zip 1.18.0 开始,可用于关闭归档。
+ Zip 归档的系统状态。从 PHP 8.0.0 和 PECL zip 1.18.0 开始,可用于关闭归档。
numFiles
- 归档里的文件数
+ 归档里的文件数
filename
- 在文件系统里的文件名
+ 在文件系统里的文件名
comment
- 归档里的注释
+ 归档里的注释
diff --git a/reference/zip/ziparchive/clearerror.xml b/reference/zip/ziparchive/clearerror.xml
index 8095e8391..191b6b216 100644
--- a/reference/zip/ziparchive/clearerror.xml
+++ b/reference/zip/ziparchive/clearerror.xml
@@ -1,6 +1,7 @@
-
+
+
ZipArchive::clearError
@@ -12,9 +13,9 @@
public voidZipArchive::clearError
-
+
清除状态错误消息、系统和/或 zip 消息。
-
+
@@ -24,9 +25,9 @@
&reftitle.returnvalues;
-
+
&return.void;
-
+
diff --git a/reference/zip/ziparchive/extractto.xml b/reference/zip/ziparchive/extractto.xml
index 7cb032fbb..85216bc91 100644
--- a/reference/zip/ziparchive/extractto.xml
+++ b/reference/zip/ziparchive/extractto.xml
@@ -1,7 +1,7 @@
-
-
+
+
ZipArchive::extractTo
@@ -14,17 +14,17 @@
stringpathto
arraystringnullfiles&null;
-
+
将完整归档或指定文件提取到指定的目录。
-
+
-
+
提取的文件和目录的默认权限提供尽可能广泛的访问权限。这可以通过设置当前 umask 来限制,可以使用 umask 更改。
-
-
+
+
出于安全原因,不会恢复原始权限。有关如何还原的示例,请参阅 ZipArchive::getExternalAttributesIndex
页面上的代码示例。
-
+
@@ -34,17 +34,17 @@
pathto
-
+
解压缩的本地目标路径
-
+
files
-
+
要提取的条目。接受单个条目名称或名称数组。
-
+
@@ -52,9 +52,9 @@
&reftitle.returnvalues;
-
+
&return.success;
-
+
&reftitle.examples;
diff --git a/reference/zip/ziparchive/getarchiveflag.xml b/reference/zip/ziparchive/getarchiveflag.xml
index 51b81f174..f716540e6 100644
--- a/reference/zip/ziparchive/getarchiveflag.xml
+++ b/reference/zip/ziparchive/getarchiveflag.xml
@@ -1,6 +1,6 @@
-
+
@@ -14,9 +14,9 @@
intflag
intflags0
-
+
返回 Zip 归档全局 flag 的值。
-
+
@@ -30,24 +30,24 @@
检索的全局 flag,包含 AFL_* 常量:
-
+
ZipArchive::AFL_RDONLY
-
+
-
+
ZipArchive::AFL_IS_TORRENTZIP
-
+
-
+
ZipArchive::AFL_WANT_TORRENTZIP
-
+
-
+
ZipArchive::AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE
-
+
@@ -56,9 +56,9 @@
flags
-
+
如果将 flags 设置为 ZipArchive::FL_UNCHANGED,则返回原始未更改的 flag。
-
+
@@ -67,9 +67,9 @@
&reftitle.returnvalues;
-
+
如果 flag 在归档中设置了,返回 1,没有返回 0,发生错误,返回 -1。
-
+
diff --git a/reference/zip/ziparchive/setarchiveflag.xml b/reference/zip/ziparchive/setarchiveflag.xml
index 37b34690c..daa8fb1ef 100644
--- a/reference/zip/ziparchive/setarchiveflag.xml
+++ b/reference/zip/ziparchive/setarchiveflag.xml
@@ -1,6 +1,6 @@
-
+
@@ -14,9 +14,9 @@
intflag
intvalue
-
+
设置 ZIP 归档的全局 flag。
-
+
&reftitle.parameters;
@@ -29,14 +29,14 @@
要改变的全局 flag,包含 AFL_* 常量。
-
+
ZipArchive::AFL_WANT_TORRENTZIP
-
+
-
+
ZipArchive::AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE
-
+
@@ -45,9 +45,9 @@
value
-
+
flag 的新值。
-
+
@@ -56,9 +56,9 @@
&reftitle.returnvalues;
-
+
&return.success;
-
+