php url transcoding functions include: 1. The urlencode function is used to encode the URL string; 2. The urldecode function is used to decode the encoded URL string; 3. The rawurlencode function is used to encode the URL according to RFC3986 ;4. rawurldecode is used for decoding.
The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer
urlencode — Encode URL string
Description
urlencode ( string $str ) : string
This function facilitates encoding a string and using it in the request part of the URL, and it also facilitates converting variables Passed to the next page.
Parameters
str
The string to be encoded.
Return value
Returns a string. All non-alphanumeric characters in this string except -_. will be replaced with a percent sign (%) followed by two digits. Base number, spaces are encoded as plus signs ( ). This encoding is the same as the encoding of WWW form POST data, and the same encoding as the application/x-www-form-urlencoded media type. For historical reasons, this encoding differs from the » RFC3986 encoding (see rawurlencode()) in encoding spaces as plus signs ( ).
urldecode — Decode an encoded URL string
Description
urldecode ( string $ str ) : string
Decode any %## in the given encoded string. The plus sign (' ') is decoded into a space character.
Parameters
str
The string to be decoded.
Return value
Returns the decoded string.
rawurlencode() - Encodes a URL according to RFC 3986
PHP video tutorial]
The above is the detailed content of What are the php url transcoding functions?. For more information, please follow other related articles on the PHP Chinese website!