note 47132 added to function.urlencode
| From: | george at ishop dot com | Date: | Thu, 04 Nov 2004 09:35:34 +0000 |
| Subject: | note 47132 added to function.urlencode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-79582@lists.php.net to get a copy of this message | ||
For handling slashes in redirections, (see comment from cameron at enprises dot com), try this :
function myurlencode ( $TheVal )
{
return urlencode (str_replace("/","%2f",$TheVal));
}
function myurldecode ( $TheVal )
{
return str_replace("%2f","/",urldecode ($TheVal));
}
This is effectively a double urlencode for slashes and single urlencode for everything else. So, it
is more "standardised" than his suggestion of using a + sign, and more readable (and
search engine indexable) than a full double encode/decode.
----
Manual Page -- http://www.php.net/manual/en/function.urlencode.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47132
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47132&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47132&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47132&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47132&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47132&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47132&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47132&report=yes
Search -- http://master.php.net/manage/user-notes.php