PHP urlencode and Rawurlencode tutorial Rawurlencode
(PHP 4, PHP 5)
Rawurlencode-URL encoding based on RFC 1738
Describe
String Rawurlencode (String $str)
Encode a specific string according to the» RFC 1738.
Parameters
Str
Encode the URL.
return value
Returns all non-alphanumeric characters in a string except for-_. is replaced with a percent sign (%) symbol followed by two hexadecimal digits. This is the encoding description» RFC 1738 for the protection of literal characters that are interpreted as special URL-delimited and protected URLs that are corrupted by the transmission media conversion and nature (such as some e-mail systems).
Instance
For example # 1 includes a password for the FTP URL
$a = Explode (' & ', $QUERY _string);
$i = 0;
while ($i < count ($a)) {
$b = Split (' = ', $a [$i]);
Echo ' Value for parameter ', Htmlspecialchars (UrlDecode ($b [0])),
' Is ', Htmlspecialchars (UrlDecode ($b [1])), "
n ";
$i + +;
}
?>
For UrlEncode
(PHP 4, PHP 5)
Make UrlEncode-URL encoded string
Describe
String UrlEncode (String $str)
This handy encoding string is used as part of the query URL, as a convenient way to pass the next page of the variable.
Parameters
Str
String encoding.
return value
Returns all non-alphanumeric characters in a string except for-_. is replaced with a percent sign (%) symbol followed by two hexadecimal digits and a space encoded as a plus sign (+). This is the same encoding method from the published data encoded in the WWW form, which is the same way in the application/x www form of the urlencoded media type. This differs from the reference» RFC 1738 encoding (see Rawurlencode ()), for historical reasons, the space encoded as a plus sign (+) sign.
Instance
Example # 1 For an example of UrlEncode ()
Echo ';
?>
Example #2 UrlEncode () and htmlentities () Example
$query _string = ' foo= '. UrlEncode ($foo). ' &bar= '. UrlEncode ($bar);
Echo ';
?>
http://www.bkjia.com/PHPjc/630888.html www.bkjia.com true http://www.bkjia.com/PHPjc/630888.html techarticle php urlencode with rawurlencode tutorial Rawurlencode (PHP 4, PHP 5) rawurlencode-URL encoding based on RFC 1738 describes the string Rawurlencode (string $st R) encoding specific ...