php-doc-en/reference/filesystem/functions/file-get-contents.xml
Sean Coates 02eb4ce4fc see also: file_put_contents()
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@173397 c90b9560-bf6c-de11-be94-00142212c4b1
2004-11-23 19:43:51 +00:00

72 lines
2.5 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.21 $ -->
<!-- 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>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>file_get_contents</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>use_include_path</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>context</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>offset</parameter></methodparam>
</methodsynopsis>
<para>
Identical to <function>file</function>, except that
<function>file_get_contents</function> returns the file in a string,
starting at the specified <parameter>offset</parameter>.
On failure, <function>file_get_contents</function> will return &false;.
</para>
<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
supported by your OS to enhance performance.
</para>
<note>
<simpara>
The <parameter>offset</parameter> parameter was added in PHP 5.1.0.
</simpara>
</note>
<note>
<para>
If you're opening a URI with special characters, such as spaces, you
need to encode the URI with <function>urlencode</function>.
</para>
</note>
&note.bin-safe;
&tip.fopen-wrapper;
&note.context-support;
&warn.ssl-non-standard;
<simpara>
See also <function>fgets</function>, <function>file</function>,
<function>fread</function>, <function>include</function>,
<function>readfile</function> &listendand;
<function>file_put_contents</function>
</simpara>
</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
-->