nlopess Fri Sep 22 17:05:11 2006 UTC
Modified files:
/phpdoc/en/appendices wrappers.xml
Log:
add php://memory and php://temp
http://cvs.php.net/viewvc.cgi/phpdoc/en/appendices/wrappers.xml?r1=1.64&r2=1.65&diff_format=u
Index: phpdoc/en/appendices/wrappers.xml
diff -u phpdoc/en/appendices/wrappers.xml:1.64
phpdoc/en/appendices/wrappers.xml:1.65
--- phpdoc/en/appendices/wrappers.xml:1.64 Fri Sep 22 15:39:56 2006
+++ phpdoc/en/appendices/wrappers.xml Fri Sep 22 17:05:11 2006
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.64 $ -->
+<!-- $Revision: 1.65 $ -->
<appendix id="wrappers">
<title>List of Supported Protocols/Wrappers</title>
<para>
@@ -603,11 +603,6 @@
<section id="wrappers.php">
<title>PHP input/output streams</title>
- <simpara>
- PHP 3.0.13 and up, <filename>php://output</filename>
- and <filename>php://input</filename> since PHP 4.3.0,
- <filename>php://filter</filename> since PHP 5.0.0.
- </simpara>
<itemizedlist>
<listitem><simpara><filename>php://stdin</filename></simpara></listitem>
@@ -615,7 +610,9 @@
<listitem><simpara><filename>php://stderr</filename></simpara></listitem>
<listitem><simpara><filename>php://output</filename></simpara></listitem>
<listitem><simpara><filename>php://input</filename></simpara></listitem>
- <listitem><simpara><filename>php://filter</filename></simpara></listitem>
+ <listitem><simpara><filename>php://filter</filename> (available since PHP
5.0.0)</simpara></listitem>
+ <listitem><simpara><filename>php://memory</filename> (available since PHP
5.1.0)</simpara></listitem>
+ <listitem><simpara><filename>php://temp</filename> (available since PHP
5.1.0)</simpara></listitem>
</itemizedlist>
<simpara>
@@ -730,6 +727,44 @@
</simpara>
</listitem>
</itemizedlist>
+
+ <simpara>
+ The <filename>php://memory</filename> wrapper stores the data in the
+ memory. <filename>php://temp</filename> behaves similarly, but uses a
+ temporary file for storing the data when a certain memory limit is reached
+ (the default is 2 MB).
+ </simpara>
+ <simpara>
+ The <filename>php://temp</filename> wrapper takes the following
+ 'parameters' as parts of its 'path':
+ </simpara>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>/maxmemory:<number of bytes></literal>
+ (<emphasis>optional</emphasis>). This parameter allows changing the
+ default value for the memory limit (when the data is moved to a temporary
+ file).
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$fiveMBs = 5 * 1024 * 1024;
+$fp = fopen("php://temp/maxmemory:$fiveMBs", 'r+');
+
+fputs($fp, "hello\n");
+
+// read what we have written
+rewind($fp);
+echo stream_get_contents($fp);
+?>
+]]>
+ </programlisting>
+ </informalexample>
+ </para>
+ </listitem>
+ </itemizedlist>
+
<para>
<table>
<title>
@@ -751,33 +786,45 @@
<row>
<entry>Allows Reading</entry>
<entry>
- <literal>php://stdin</literal> and
- <literal>php://input</literal> only.
+ <literal>php://stdin</literal>,
+ <literal>php://input</literal>,
+ <literal>php://memory</literal> and
+ <literal>php://temp</literal> only.
</entry>
</row>
<row>
<entry>Allows Writing</entry>
<entry>
<literal>php://stdout</literal>,
- <literal>php://stderr</literal>, and
- <literal>php://output</literal> only.
+ <literal>php://stderr</literal>,
+ <literal>php://output</literal>,
+ <literal>php://memory</literal> and
+ <literal>php://temp</literal> only.
</entry>
</row>
<row>
<entry>Allows Appending</entry>
<entry>
<literal>php://stdout</literal>,
- <literal>php://stderr</literal>, and
- <literal>php://output</literal> only. (Equivalent to writing)
+ <literal>php://stderr</literal>,
+ <literal>php://output</literal>,
+ <literal>php://memory</literal> and
+ <literal>php://temp</literal> only. (Equivalent to writing)
</entry>
</row>
<row>
<entry>Allows Simultaneous Reading and Writing</entry>
- <entry>No. These wrappers are unidirectional.</entry>
+ <entry>
+ <literal>php://memory</literal> and
+ <literal>php://temp</literal> only.
+ </entry>
</row>
<row>
<entry>Supports <function>stat</function></entry>
- <entry>No</entry>
+ <entry>
+ <literal>php://memory</literal> and
+ <literal>php://temp</literal> only.
+ </entry>
</row>
<row>
<entry>Supports <function>unlink</function></entry>