- ??encodeURIComponent()?decodeURIComponent()??:
// ?? var encodedUrl = encodeURIComponent("https://www.example.com?name=??&age=20"); console.log(encodedUrl); // https://www.example.com?name=张三&age=20 // ?? var decodedUrl = decodeURIComponent(encodedUrl); console.log(decodedUrl); // https://www.example.com?name=??&age=20
- ??encodeURI()?decodeURI()??:
// ?? var encodedUrl = encodeURI("https://www.example.com?name=??&age=20"); console.log(encodedUrl); // https://www.example.com?name=张三&age=20 // ?? var decodedUrl = decodeURI(encodedUrl); console.log(decodedUrl); // https://www.example.com?name=??&age=20
- ??escape()?unescape()??(?????,????):
// ?? var encodedUrl = escape("https://www.example.com?name=??&age=20"); console.log(encodedUrl); // https://www.example.com?name=张三&age=20 // ?? var decodedUrl = unescape(encodedUrl); console.log(decodedUrl); // https://www.example.com?name=??&age=20