![JS加解密URL参数encodeURIComponent() decodeURIComponent() JS加解密URL参数encodeURIComponent() decodeURIComponent()](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
参考1:http://www.w3school.com.cn/js/jsref_encodeURIComponent.asp
参考2:http://www.w3school.com.cn/js/jsref_decodeURIComponent.asp
实例:
<script type="text/javascript"> var test1="http://www.w3school.com.cn/My first/" document.write(encodeURIComponent(test1)+ "<br />")
document.write(decodeURIComponent(test1)) </script>
输出:
http%3A%2F%2Fwww.w3school.com.cn%2FMy%20first%2F
http://www.w3school.com.cn/My first/