Created
January 11, 2015 22:57
-
-
Save royopa/cacdde4e16714f505c72 to your computer and use it in GitHub Desktop.
Updating reference/url/functions/urldecode.xml - Rodrigo Prado de Jesus <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: reference/url/functions/urldecode.xml | |
| =================================================================== | |
| --- reference/url/functions/urldecode.xml (revision 335717) | |
| +++ reference/url/functions/urldecode.xml (working copy) | |
| @@ -1,6 +1,6 @@ | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| -<!-- EN-Revision: n/a Maintainer: fernandoc Status: ready --><!-- CREDITS: soneca --> | |
| -<refentry xml:id="function.urldecode" xmlns="http://docbook.org/ns/docbook"> | |
| +<!-- EN-Revision: 328365 Maintainer: fernandoc Status: ready --><!-- CREDITS: soneca, royopa --> | |
| +<refentry xml:id="function.urldecode" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
| <refnamediv> | |
| <refname>urldecode</refname> | |
| <refpurpose>Decodifica uma URL codificada</refpurpose> | |
| @@ -14,7 +14,8 @@ | |
| </methodsynopsis> | |
| <para> | |
| Decodifica qualquer <literal>%<replaceable>##</replaceable></literal> | |
| - codificado na string. | |
| + codificado na string. Os símbolos 'mais' ('<literal>+</literal>') são | |
| + decodificados para um caractere de espaço. | |
| </para> | |
| </refsect1> | |
| @@ -49,13 +50,14 @@ | |
| <programlisting role="php"> | |
| <![CDATA[ | |
| <?php | |
| -$a = split ('&', $querystring); | |
| -$i = 0; | |
| -while ($i < count ($a)) { | |
| - $b = split ('=', $a [$i]); | |
| - echo 'Value for parameter ', htmlspecialchars (urldecode ($b [0])), | |
| - ' is ', htmlspecialchars (urldecode ($b [1])), "<BR>"; | |
| - $i++; | |
| +$query = "my=apples&are=green+and+red"; | |
| + | |
| +foreach (explode('&', $query) as $chunk) { | |
| + $param = explode("=", $chunk); | |
| + | |
| + if ($param) { | |
| + printf("Value for parameter \"%s\" is \"%s\"<br/>\n", urldecode($param[0]), urldecode($param[1])); | |
| + } | |
| } | |
| ?> | |
| ]]> | |
| @@ -64,6 +66,18 @@ | |
| </para> | |
| </refsect1> | |
| + <refsect1 role="notes"> | |
| + &reftitle.notes; | |
| + <warning> | |
| + <para> | |
| + As superglobais <varname>$_GET</varname> e <varname>$_REQUEST</varname> | |
| + já são decodificadas. Usar <function>urldecode</function> em um elemento | |
| + <varname>$_GET</varname> ou <varname>$_REQUEST</varname> podem gerar | |
| + resultados inesperados e perigosos. | |
| + </para> | |
| + </warning> | |
| + </refsect1> | |
| + | |
| <refsect1 role="seealso"> | |
| &reftitle.seealso; | |
| <para> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment