Both PHP and JS have different ways of handling some special characters for URL encoding and decoding. It's not considered here.
escape()
, mainly JS's
encodeURI() 、encodeURIComponent()
With PHP's
urlencode() 、rawurlencode()
Access to the information is:
urlencode()
The _-.
characters are processed, and the spaces are encoded differently from the other functions;
urlencode()
rawurlencode()
~
It's not the same as the right deal.
encodeURI()
does not encode except _-.
the outside~!*()'
encodeURIComponnect()
does not encode except _-.
the outside~!@#$&*()=:/,;?+'
Assuming that the encoding of the UTF-8, how to unify the front and back end of the URL codec? What better solution to deal with this problem
Reply content:
Both PHP and JS have different ways of handling some special characters for URL encoding and decoding. This is not considered escape()
, mainly JS and encodeURI() 、encodeURIComponent()
PHPurlencode() 、rawurlencode()
Access to the information is:
urlencode()
The _-.
characters are processed, and the spaces are encoded differently from the other functions;
urlencode()
rawurlencode()
~
It's not the same as the right deal.
encodeURI()
does not encode except _-.
the outside~!*()'
encodeURIComponnect()
does not encode except _-.
the outside~!@#$&*()=:/,;?+'
Assuming that the encoding of the UTF-8, how to unify the front and back end of the URL codec? What better solution to deal with this problem
Transcoding is used to escape special characters in the URL, with Encodeuricomponnect has been no problem