Phpurlencode and rawurlencode tutorial. Phpurlencode and rawurlencode tutorial rawurlencode (PHP4, PHP5) rawurlencode-URL encoding based on RFC1738 describes the string rawurlencode (string $ str) encoding specific php urlencode and rawurlencode tutorial rawurlencode
(PHP 4 and PHP 5)
Rawurlencode-URL encoding according to RFC 1738
Description
String rawurlencode (string $ str)
Encode a specific string according to RFC 1738.
Parameters
Str
Encode the URL.
Return value
Returns all non-alphanumeric characters in a string -_. It is replaced with a percent sign (%) followed by two hexadecimal numbers. This is the encoding description» RFC 1738 protects the conversion and nature of the transmitted media (such as some email systems) of URLs that are separated and protected by special URLs ).
Instance
For example, #1 includes an FTP website with a password
$ A = explode ('&', $ QUERY_STRING );
$ I = 0;
While ($ I <count ($ )){
$ B = split ('=', $ a [$ I]);
Echo 'Value for parameter ', htmlspecialchars (urldecode ($ B [0]),
'Is, htmlspecialchars (urldecode ($ B [1]),"
N ";
$ I ++;
}
?>
Urlencode
(PHP 4 and PHP 5)
URL encoded string
Description
Urlencode string (string $ str)
This function allows you to easily encode a string as part of a URL to be queried and pass the next page of a variable.
Parameters
Str
String encoding.
Return value
Returns all non-alphanumeric characters in a string -_. Signs of being replaced with a percent sign (%) followed by two hexadecimal numbers and spaces encoded as the plus sign (+. This is the same encoding method, from the published data encoding WWW form, which is the same method in the application/x www form of the urlencoded media type. This is different from the historical reasons in reference» RFC 1738 encoding (see rawurlencode (), where space encoding is a plus sign (+.
Instance
Example of urlencode () in #1
Echo '';
?>
Example #2 urlencode () and htmlentities () example
$ Query_string = 'foo = '. urlencode ($ foo).' & bar = '. urlencode ($ bar );
Echo '';
?>
Http://www.bkjia.com/PHPjc/630888.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/630888.htmlTechArticlephp urlencode with rawurlencode tutorial rawurlencode (PHP 4, PHP 5) rawurlencode-URL encoding according to RFC 1738 describe the string rawurlencode (string $ str) encoding specific...