mirror of
https://github.com/php/doc-ru.git
synced 2025-08-20 23:31:15 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/ru/trunk@171363 c90b9560-bf6c-de11-be94-00142212c4b1
83 lines
2.9 KiB
XML
83 lines
2.9 KiB
XML
<?xml version="1.0" encoding="windows-1251"?>
|
|
<!-- EN-Revision: 1.19 Maintainer: tronic Status: ready -->
|
|
<!-- $Revision: 1.3 $ -->
|
|
<!-- 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>Ïîëó÷èòü ñîäåðæèìîå ôàéëà â âèäå îäíîé ñòðîêè</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Îïèñàíèå</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>
|
|
Äàííàÿ ôóíêöèÿ èäåíòè÷íà ôóíêöèè <function>file</function> ñ òîé òîëüêî
|
|
ðàçíèöåé, ÷òî ñîäåðæèìîå ôàéëà âîçâðàùàåòñÿ â ñòðîêå, íà÷èíàÿ ñ
|
|
óêàçàííîãî ñìåùåíèÿ <parameter>offset</parameter>.
|
|
 ñëó÷àå íåóäà÷è, <function>file_get_contents</function> âåðí¸ò &false;.
|
|
</para>
|
|
<para>
|
|
Èñïîëüçîâàíèå ôóíêöèè <function>file_get_contents</function> íàèáîëåå ïðåäïî÷òèòåëüíî
|
|
â ñëó÷àå íåîáõîäèìîñòè ïîëó÷èòü ñîäåðæèìîå ôàéëà öåëèêîì, ïîñêîëüêó äëÿ óëó÷øåíèÿ
|
|
ïðîèçâîäèòåëüíîñòè ôóíêöèÿ èñïîëüçóåò àëãîðèòì 'memory mapping' (åñëè ïîääåðæèâàåòñÿ
|
|
îïåðàöèîííîé ñèñòåìîé).
|
|
</para>
|
|
<note>
|
|
<simpara>
|
|
Ïàðàìåòð <parameter>offset</parameter> áûë äîáàâëåí â âåðñèè PHP 5.1.0.
|
|
</simpara>
|
|
</note>
|
|
<example>
|
|
<title>Èñïîëüçîâàíèå <function>file_get_contents</function> ñ URI</title>
|
|
<para>
|
|
Åñëè âû îòêðûâàåòå URI ñîäåðæàùèé ñïåöñèìâîëû, òàêèå êàê ïðîáåë, âàì íóæíî
|
|
çàêîäèðîâàòü URI ïðè ïîìîùè <function>urlencode</function>.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$url = 'http://example.com/with funny chars';
|
|
list($protocol, $uri) = split('//', $url);
|
|
$html = file_get_contents($protocol . '//' . urlencode($uri));
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
¬e.bin-safe;
|
|
&tip.fopen-wrapper;
|
|
¬e.context-support;
|
|
&warn.ssl-non-standard;
|
|
<simpara>
|
|
Ñì.òàêæå îïèñàíèÿ ôóíêöèé <function>fgets</function>, <function>file</function>,
|
|
<function>fread</function>, <function>include</function> è <function>readfile</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
|
|
-->
|