com doc/zh: update file(): reference/filesystem/functions/file.xml
| From: | Dai Jie | Date: | Sun, 07 Feb 2021 09:34:40 +0000 |
| Subject: | com doc/zh: update file(): reference/filesystem/functions/file.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-5962@lists.php.net to get a copy of this message | ||
Commit: d20b91d4562754fbbc4205d926fc866951d013ce
Author: 蒋文健 <jwjbjg@gmail.com> Fri, 5 Feb 2021 16:06:03 +0800
Committer: daijie <daijie@php.net> Sun, 7 Feb 2021 17:34:40 +0800
Parents: f7a8f229ac78b1aa5f57e4eda98211324bcb6508
Branches: master
Link: http://git.php.net/?p=doc/zh.git;a=commitdiff;h=d20b91d4562754fbbc4205d926fc866951d013ce
Log:
update file()
Changed paths:
M reference/filesystem/functions/file.xml
Diff:
diff --git a/reference/filesystem/functions/file.xml b/reference/filesystem/functions/file.xml
index acf51c58..52431dd4 100755
--- a/reference/filesystem/functions/file.xml
+++ b/reference/filesystem/functions/file.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<!-- EN-Revision: 84b8fca68fc762fefe85acde180a38b2e77a28b9 Maintainer: HonestQiao Status: ready
-->
+<!-- EN-Revision: e41806c30bf6975e452c0d4ce35ab0984c2fa68c Maintainer: HonestQiao Status: ready
-->
<!-- Reviewed: no Maintainer: HonestQiao -->
-<refentry xml:id="function.file" xmlns="http://docbook.org/ns/docbook">
+<refentry xmlns="http://docbook.org/ns/docbook"
xml:id="function.file">
<refnamediv>
<refname>file</refname>
<refpurpose>把整个文件读入一个数组中</refpurpose>
@@ -19,7 +19,7 @@
<para>
把整个文件读入一个数组中。
</para>
- <note>
+ <note>
<para>
你可以通过 <function>file_get_contents</function>
以字符串形式获取文件的内容。
</para>
@@ -76,31 +76,6 @@
</simpara>
</listitem>
</varlistentry>
- <!-- FIXME PHP_6
- <varlistentry>
- <term>
- <constant>FILE_TEXT</constant>
- </term>
- <listitem>
- <simpara>
- The content is returned in UTF-8 encoding. You can specify a different
- encoding by creating a custom context. This flag cannot be used with
- <constant>FILE_BINARY</constant>.
- </simpara>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <constant>FILE_BINARY</constant>
- </term>
- <listitem>
- <simpara>
- The content is read as binary data. This is the default setting
- and cannot be used with <constant>FILE_TEXT</constant>.
- </simpara>
- </listitem>
- </varlistentry>
- -->
</variablelist>
</para>
</listitem>
@@ -109,8 +84,7 @@
<term><parameter>context</parameter></term>
<listitem>
<para>
- A context resource created with the
- <function>stream_context_create</function> function.
+ 使用 <function>stream_context_create</function>
函数创建的上下文资源(resource)。
</para>
<para>
¬e.context-support;
@@ -124,71 +98,21 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
- Returns the file in an array. Each element of the array corresponds to a
- line in the file, with the newline still attached. Upon failure,
- <function>file</function> returns &false;.
+
返回数组形式的文件内容。数组的每个元素对应于文件中的一行(结尾会附加换行符)。
+ 失败时,<function>file</function> 返回 &false;。
</para>
<note>
<para>
- Each line in the resulting array will include the line ending, unless
- <constant>FILE_IGNORE_NEW_LINES</constant> is used, so you still need to
- use <function>rtrim</function> if you do not want the line ending
- present.
+ 除非使用了 <constant>FILE_IGNORE_NEW_LINES</constant>
,否则结果数组中的每一行都将包含行尾。
</para>
</note>
¬e.line-endings;
</refsect1>
- <refsect1 role="changelog">
- &reftitle.changelog;
+ <refsect1 role="errors">
+ &reftitle.errors;
<para>
- <informaltable>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>&Version;</entry>
- <entry>&Description;</entry>
- </row>
- </thead>
- <tbody>
- <!-- FIXME PHP_6
- <row>
- <entry>6.0.0</entry>
- <entry>
- Added support for the <constant>FILE_TEXT</constant> and
- <constant>FILE_BINARY</constant> flags.
- <note>
- <para>
- For <literal>forward compatibility</literal>, these constants are
- available as of PHP 5.2.7
- </para>
- </note>
- </entry>
- </row>
- -->
- <row>
- <entry>5.0.0</entry>
- <entry>
- 增加了参数 <parameter>context</parameter>
- </entry>
- </row>
- <row>
- <entry>5.0.0</entry>
- <entry>
- Prior to PHP 5.0.0 the <parameter>flags</parameter> parameter only
- covered <link linkend="ini.include-path">include_path</link> and was
- enabled with 1
- </entry>
- </row>
- <row>
- <entry>4.3.0</entry>
- <entry>
- <function>file</function> 开始是二进制安全的
- </entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
+ 如果文件不存在,则发出 <constant>E_WARNING</constant> 级错误。
</para>
</refsect1>
@@ -228,7 +152,7 @@ $trimmed = file('somefile.txt', FILE_IGNORE_NEW_LINES |
FILE_SKIP_EMPTY_LINES);
&warn.ssl-non-standard;
</refsect1>
- <refsect1 role="seealso">
+ <refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
@@ -242,6 +166,7 @@ $trimmed = file('somefile.txt', FILE_IGNORE_NEW_LINES |
FILE_SKIP_EMPTY_LINES);
</simplelist>
</para>
</refsect1>
+
</refentry>
<!-- Keep this comment at the end of the file