reference/filesystem/functions/file.xml
2957432ebc5ba2770805c08d5c867543ced8dd85
...
...
@@ -9,10 +9,10 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>array</type><methodname>file</methodname>
12
+
<type class="union"><type>array</type><type>false</type></type><methodname>file</methodname>
13
13
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
14
14
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
15
-
<methodparam choice="opt"><type>resource</type><parameter>context</parameter></methodparam>
15
+
<methodparam choice="opt"><type class="union"><type>resource</type><type>null</type></type><parameter>context</parameter><initializer>&null;</initializer></methodparam>
16
16
</methodsynopsis>
17
17
<para>
18
18
Reads an entire file into an array.
...
...
@@ -76,6 +76,16 @@
76
76
</simpara>
77
77
</listitem>
78
78
</varlistentry>
79
+
<varlistentry>
80
+
<term>
81
+
<constant>FILE_NO_DEFAULT_CONTEXT</constant>
82
+
</term>
83
+
<listitem>
84
+
<simpara>
85
+
Don't use the default context
86
+
</simpara>
87
+
</listitem>
88
+
</varlistentry>
79
89
</variablelist>
80
90
</para>
81
91
</listitem>
...
...
@@ -83,13 +93,7 @@
83
93
<varlistentry>
84
94
<term><parameter>context</parameter></term>
85
95
<listitem>
86
-
<para>
87
-
A context resource created with the
88
-
<function>stream_context_create</function> function.
89
-
</para>
90
-
<para>
91
96
&note.context-support;
92
-
</para>
93
97
</listitem>
94
98
</varlistentry>
95
99
</variablelist>
...
...
@@ -137,10 +141,7 @@ foreach ($lines as $line_num => $line) {
137
141
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
138
142
}
139
143

140
-
// Another example, let's get a web page into a string. See also file_get_contents().
141
-
$html = implode('', file('http://www.example.com/'));
142
-

143
-
// Using the optional flags parameter since PHP 5
144
+
// Using the optional flags parameter
144
145
$trimmed = file('somefile.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
145
146
?>
146
147
]]>
...
...
@@ -158,11 +159,11 @@ $trimmed = file('somefile.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
158
159
&reftitle.seealso;
159
160
<para>
160
161
<simplelist>
162
+
<member><function>file_get_contents</function></member>
161
163
<member><function>readfile</function></member>
162
164
<member><function>fopen</function></member>
163
165
<member><function>fsockopen</function></member>
164
166
<member><function>popen</function></member>
165
-
<member><function>file_get_contents</function></member>
166
167
<member><function>include</function></member>
167
168
<member><function>stream_context_create</function></member>
168
169
</simplelist>
169
170