GET传参数转义
encodeURI()函数和encodeURIComponent()函数
encodeURI()和encodeURIComponent()都是Javascript中对URL编码的函数。
但是区别在于:
encodeURI()着眼于对整个URL进行编码,特殊含义的符号"; / ? : @ & = + $ , #“不进行编码
encodeURIComponent()对URL的组成部分进行个别编码,所以”; / ? : @ & = + $ , #"在这里是可以进行编码
所以我一般进行设置时候,会在http路径采用encodeURI进行编码,但是在路径中携带的参数采用encodeURIComponent进行编码