Need to use urlencode to process parameters
why?
1. When the string data is passed to the web server in the form of url, spaces and special strings are not allowed in the string
2. The url has restrictions on characters. For example, to put a mailbox into the url, you need to use the urlencode function
3. The url escape is actually just to comply with the url specification. Because in the standard url specification, Chinese and many characters are not allowed to appear in the url
how to use:
Description of urlencode:
urlencode ( string
$str
) : stringThis function is convenient for encoding a string and using it in the request part of the URL, and it is also convenient for passing variables to the next page.
parameter
str the string to encode
return value
Returns a string in which all non-alphanumeric characters except -_. are replaced with a percent sign (%) followed by a two-digit hexadecimal digit
npm install urlencode
import urlencode from urlencode
let str = '[123123,123234]'
let encode = urlencode(str)
// 结果 encode = '%5B123123%2C123234%5D'