cvs: phpdoc-fr /reference/filesystem/functions file-get-contents.xml
| From: | Damien Seguy | Date: | Wed, 11 Feb 2009 11:38:14 +0000 |
| Subject: | cvs: phpdoc-fr /reference/filesystem/functions file-get-contents.xml | ||
| Groups: | php.doc.fr | ||
| Request: | Send a blank email to doc-fr+get-6622@lists.php.net to get a copy of this message | ||
dams Wed Feb 11 11:38:14 2009 UTC
Modified files:
/phpdoc-fr/reference/filesystem/functions file-get-contents.xml
Log:
synch with en
http://cvs.php.net/viewvc.cgi/phpdoc-fr/reference/filesystem/functions/file-get-contents.xml?r1=1.30&r2=1.31&diff_format=u
Index: phpdoc-fr/reference/filesystem/functions/file-get-contents.xml
diff -u phpdoc-fr/reference/filesystem/functions/file-get-contents.xml:1.30
phpdoc-fr/reference/filesystem/functions/file-get-contents.xml:1.31
--- phpdoc-fr/reference/filesystem/functions/file-get-contents.xml:1.30 Thu Jan 22 19:57:26 2009
+++ phpdoc-fr/reference/filesystem/functions/file-get-contents.xml Wed Feb 11 11:38:14 2009
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.30 $ -->
-<!-- EN-Revision: 1.33 Maintainer: yannick Status: ready -->
+<!-- $Revision: 1.31 $ -->
+<!-- EN-Revision: 1.34 Maintainer: yannick Status: ready -->
<!-- Reviewed: yes -->
<refentry xmlns="http://docbook.org/ns/docbook"
xml:id="function.file-get-contents">
@@ -161,6 +161,77 @@
</para>
</refsect1>
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title>Lit et affiche le code HTML d'un site Web</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$homepage = file_get_contents('http://www.example.com/');
+echo $homepage;
+?>
+]]>
+ </programlisting>
+ </example>
+ <example>
+ <title>Recherche un fichier dans le include_path</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// avant PHP 5
+$file = file_get_contents('./people.txt', true);
+// depuis PHP 5
+$file = file_get_contents('./people.txt', FILE_USE_INCLUDE_PATH);
+?>
+]]>
+ </programlisting>
+ </example>
+ <example>
+ <title>Lit une section d'un fichier</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// Lit 50 caractères à partir du 100ème
+$section = file_get_contents('./people.txt', NULL, NULL, 20, 14);
+var_dump($section);
+?>
+]]>
+ </programlisting>
+ &example.outputs.similar;
+ <screen>
+<![CDATA[
+string(14) "lle Bjori Ro"
+]]>
+ </screen>
+ </example>
+ <example>
+ <title>Utilisation des contextes de flux</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// Création d'un flux
+$opts = array(
+ 'http'=>array(
+ 'method'=>"GET",
+ 'header'=>"Accept-language: en\r\n" .
+ "Cookie: foo=bar\r\n"
+ )
+);
+
+$context = stream_context_create($opts);
+
+// Accès à un fichier HTTP avec les entêtes HTTP indiqués ci-dessus
+$file = file_get_contents('http://www.example.com/', false, $context);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+
+
<refsect1 role="changelog">
&reftitle.changelog;
<para>