svn: /phpdoc/en/trunk/reference/phar/Phar/ webPhar.xml
| From: | Sherif Ramadan | Date: | Mon, 26 Nov 2012 21:15:35 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/phar/Phar/ webPhar.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-10767@lists.php.net to get a copy of this message | ||
googleguy Mon, 26 Nov 2012 21:15:35 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=328502
Log:
Updated Phar::webPhar function prototype to indicate callable for the last argument instead of array
and modified the parameters description to reflect the change.
Changed paths:
U phpdoc/en/trunk/reference/phar/Phar/webPhar.xml
Modified: phpdoc/en/trunk/reference/phar/Phar/webPhar.xml
===================================================================
--- phpdoc/en/trunk/reference/phar/Phar/webPhar.xml 2012-11-26 21:11:18 UTC (rev 328501)
+++ phpdoc/en/trunk/reference/phar/Phar/webPhar.xml 2012-11-26 21:15:35 UTC (rev 328502)
@@ -14,7 +14,7 @@
<methodparam
choice="opt"><type>string</type><parameter>index</parameter><initializer>"index.php"</initializer></methodparam>
<methodparam
choice="opt"><type>string</type><parameter>f404</parameter></methodparam>
<methodparam
choice="opt"><type>array</type><parameter>mimetypes</parameter></methodparam>
- <methodparam
choice="opt"><type>array</type><parameter>rewrites</parameter></methodparam>
+ <methodparam
choice="opt"><type>callable</type><parameter>rewrites</parameter></methodparam>
</methodsynopsis>
<para>
<function>Phar::mapPhar</function> for web-based phars. This method parses
@@ -125,22 +125,17 @@
<term><parameter>rewrites</parameter></term>
<listitem>
<para>
- An array mapping URI to internal file, simulating mod_rewrite of apache.
- For example:
- <programlisting role="php">
- <![CDATA[
-<?php
-array(
- 'myinfo' => 'myinfo.php'
-);
-?>
- ]]>
- </programlisting>
- would route calls to <literal>http://<host>/myphar.phar/myinfo</literal>
- to the file <literal>phar:///path/to/myphar.phar/myinfo.php</literal>,
preserving
- GET/POST. This does not quite work like mod_rewrite in that it would not
- match <literal>http://<host>/myphar.phar/myinfo/another</literal>.
+ The rewrites function is passed a string as its only parameter and must return a
<type>string</type> or a <type>bool</type>.
</para>
+ <para>
+ If you are using fast-cgi or cgi then the parameter passed to the function is the value of
the
+ <varname>$_SERVER['PATH_INFO']</varname> variable. Otherwise, the
parameter passed to the function is the value
+ of the <varname>$_SERVER['REQUEST_URI']</varname> variable.
+ </para>
+ <para>
+ If a string is returned it is used as the internal file path. If a bool is returned then
webPhar() will
+ send a HTTP 403 Denied Code.
+ </para>
</listitem>
</varlistentry>
</variablelist>
@@ -160,7 +155,7 @@
Throws <classname>PharException</classname> when unable to open the internal
file to output, or if
called from a non-stub. If an invalid array value is passed into
- <parameter>mimetypes</parameter> or to <parameter>rewrites</parameter>,
then
+ <parameter>mimetypes</parameter> or an invalid callback is passed into
<parameter>rewrites</parameter>, then
<classname>UnexpectedValueException</classname> is thrown.
</para>
</refsect1>