Urlencode is used to encode a string. replace all non-alphanumeric characters except "-_" in the original string with a semicolon (%) followed by two hexadecimal numbers, however, note that due to historical reasons, spaces are replaced with the + number. Rawurlencode is used to encode strings like urlencode. The only difference is that it uses RFC17
Urlencode is used to encode a string. replace all non-alphanumeric characters except "-_" in the original string with a semicolon (%) followed by two hexadecimal numbers, however, note that due to historical reasons, spaces are replaced with the + number. Rawurlencode is used to encode strings like urlencode. The only difference is that it uses RFC17
Urlencode is used to encode a string. replace all non-alphanumeric characters except "-_" in the original string with a semicolon (%) followed by two hexadecimal numbers, however, note that due to historical reasons, spaces are replaced with the + number. Rawurlencode is actually used to encode strings like urlencode. The only difference is that it uses RFC1738 encoding, that is, it will replace the space with % 20.
The corresponding decoding functions are urldecode and rawurldecode. Refer to the instructions on the official website. Any % ##, plus sign ('+') in the encoded string given by urldecode is decoded into a space character; the semicolon (%) in the rawurldecode decoding character string is followed by two hexadecimal values. There are two differences: first, urldecode decoding decodes any two characters after the percent sign (%). For example, % MN can also be decoded but fails; rawurldecode only decodes the last two hexadecimal (0-9A-F) characters after the percent sign (%). Second, urldecode decodes the plus sign as a space.
Based on the description of the decoding function, we can infer that urldecode can be used to decode urlencode or rawurlencode. However, if the original string contains spaces, the string decoded using rawurlencode is different from the original string.
Original article address: difference between php urlencode and rawurlencode. Thank you for sharing it with me.