💡
encodeURIComponent vs encodeURI
原始文本:
https://example.com/搜索?q=测试&name=张三
encodeURIComponent(编码所有特殊字符):
https%3A%2F%2Fexample.com%2F%E6%90%9C%E7%B4%A2%3Fq%3D%E6%B5%8B%E8%AF%95%26name%3D%E5%BC%A0%E4%B8%89
encodeURI(保留URL结构字符 :/?#[]@!$&'()*+,;=):
https://example.com/%E6%90%9C%E7%B4%A2?q=%E6%B5%8B%E8%AF%95&name=%E5%BC%A0%E4%B8%89