There is a solution to the problem of page script assignment failure caused by the string carriage return when the url address is passed

  • 2020-06-23 00:04:40
  • OfStack

When parameters are accepted via the url address, some parameters have a value of V with a carriage return '%0A'. When the page script displays, the value V is given to the script variable, which may cause script errors.

Therefore, the above problem can be avoided by: 1 starting with url encoding 1 string at value passing and url decoding at script assignment.

In PHP, the operation functions encoded on URL are: urlencode() and urldecode()

The URL coded operation functions corresponding to js are: encodeURI() and decodeURI()


Related articles: