2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2005-06-17 08:33:56 +00:00
|
|
|
<!-- $Revision: 1.24 $ -->
|
2002-04-15 00:12:54 +00:00
|
|
|
<!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.130 -->
|
|
|
|
<refentry id="function.file-get-contents">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>file_get_contents</refname>
|
|
|
|
<refpurpose>Reads entire file into a string</refpurpose>
|
|
|
|
</refnamediv>
|
2005-02-09 17:06:38 +00:00
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2002-04-15 00:12:54 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>string</type><methodname>file_get_contents</methodname>
|
|
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
2004-01-08 09:43:27 +00:00
|
|
|
<methodparam choice="opt"><type>bool</type><parameter>use_include_path</parameter></methodparam>
|
2003-04-08 00:07:12 +00:00
|
|
|
<methodparam choice="opt"><type>resource</type><parameter>context</parameter></methodparam>
|
2004-10-15 17:31:38 +00:00
|
|
|
<methodparam choice="opt"><type>int</type><parameter>offset</parameter></methodparam>
|
2005-02-09 17:06:38 +00:00
|
|
|
<methodparam choice="opt"><type>int</type><parameter>maxlen</parameter></methodparam>
|
2002-04-15 00:12:54 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2003-01-06 23:42:51 +00:00
|
|
|
Identical to <function>file</function>, except that
|
2004-10-15 17:31:38 +00:00
|
|
|
<function>file_get_contents</function> returns the file in a string,
|
2005-02-09 17:06:38 +00:00
|
|
|
starting at the specified <parameter>offset</parameter> up to
|
|
|
|
<parameter>maxlen</parameter> bytes.
|
2004-01-16 19:29:09 +00:00
|
|
|
On failure, <function>file_get_contents</function> will return &false;.
|
2002-04-15 00:12:54 +00:00
|
|
|
</para>
|
2003-05-29 20:10:20 +00:00
|
|
|
<para>
|
|
|
|
<function>file_get_contents</function> is the preferred way to read the
|
|
|
|
contents of a file into a string. It will use memory mapping techniques if
|
2003-06-29 19:58:30 +00:00
|
|
|
supported by your OS to enhance performance.
|
2003-05-29 20:10:20 +00:00
|
|
|
</para>
|
2004-10-27 14:52:50 +00:00
|
|
|
<note>
|
2004-07-16 11:20:24 +00:00
|
|
|
<para>
|
2004-10-27 14:52:50 +00:00
|
|
|
If you're opening a URI with special characters, such as spaces, you
|
|
|
|
need to encode the URI with <function>urlencode</function>.
|
2004-07-16 11:20:24 +00:00
|
|
|
</para>
|
2004-10-27 14:52:50 +00:00
|
|
|
</note>
|
2005-03-31 15:01:44 +00:00
|
|
|
<note>
|
|
|
|
<para>
|
|
|
|
<parameter>context</parameter> parameter can be skipped by &null;.
|
|
|
|
</para>
|
|
|
|
</note>
|
2005-02-09 17:06:38 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="changelog">
|
|
|
|
&reftitle.changelog;
|
|
|
|
<para>
|
|
|
|
<informaltable>
|
|
|
|
<tgroup cols="2">
|
|
|
|
<thead>
|
|
|
|
<row>
|
|
|
|
<entry>&Version;</entry>
|
|
|
|
<entry>&Description;</entry>
|
|
|
|
</row>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<row>
|
|
|
|
<entry>5.0.0</entry>
|
|
|
|
<entry>
|
|
|
|
Added the context support.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry>5.1.0</entry>
|
|
|
|
<entry>
|
|
|
|
Added the <parameter>offset</parameter> and
|
|
|
|
<parameter>maxlen</parameter> parameters.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</informaltable>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="notes">
|
|
|
|
&reftitle.notes;
|
2002-04-15 00:12:54 +00:00
|
|
|
¬e.bin-safe;
|
|
|
|
&tip.fopen-wrapper;
|
2005-03-31 15:01:44 +00:00
|
|
|
¬e.context-support;
|
2004-02-19 16:06:56 +00:00
|
|
|
&warn.ssl-non-standard;
|
2005-02-09 17:06:38 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<para>
|
|
|
|
<simplelist>
|
|
|
|
<member><function>file</function></member>
|
|
|
|
<member><function>fgets</function></member>
|
|
|
|
<member><function>fread</function></member>
|
|
|
|
<member><function>readfile</function></member>
|
|
|
|
<member><function>file_put_contents</function></member>
|
2005-06-17 08:33:56 +00:00
|
|
|
<member><function>stream_get_contents</function></member>
|
2005-02-09 17:06:38 +00:00
|
|
|
</simplelist>
|
|
|
|
</para>
|
2002-04-15 00:12:54 +00:00
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
|
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|