一,使用 escape() 编码的字符串

 

 url加密传参有时候会出现Uncaught URIError: URI malformed的错误,这是因为你的url中包含了“%”字符,浏览器在对“%”执行decodeURIComponent时报错,正确的解决是将%全部替换为%25再进行传输

url: '/xxx/yyy?key=' + key + "&Account=" + escape(Account) + '&RealName=' + escape(RealName).replace(/%/g,'%25')

 

二,js 接收参数 使用  unescape() 对 escape() 编码的字符串进行解码

   

unescape(request('RealName'))

 

相关文章:

  • 2021-12-24
  • 2021-12-04
  • 2022-02-19
  • 2021-09-02
  • 2022-12-23
  • 2021-09-21
  • 2022-02-18
猜你喜欢
  • 2021-05-23
  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
  • 2021-07-13
相关资源
相似解决方案