随笔- 310  文章- 1  评论- 0  阅读- 86066 

编码与解码

decodeURIComponent() 函数对 URI 组件进行解码。

encodeURIComponent() 函数对 URI 组件进行编码。

Example

var uri = "https://localhost:3000/index?name=张三&car=saab";
var uri_enc = encodeURIComponent(uri);       //'https%3A%2F%2Flocalhost%3A3000%2Findex%3Fname%3D%E5%BC%A0%E4%B8%89%26car%3Dsaab'
var uri_dec = decodeURIComponent(uri_enc);   //'https://localhost:3000/index?name=张三&car=saab'

 

 posted on   boye169  阅读(393)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
点击右上角即可分享
微信分享提示