-
-
Save liutaihua/8536621 to your computer and use it in GitHub Desktop.
解析url, 把url里的query参数, 解析成json格式
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var querystring = require('querystring'); | |
var original = 'http://example.com/product/abcde.html'; | |
var escaped = querystring.escape(original); | |
console.log(escaped); | |
// http%3A%2F%2Fexample.com%2Fproduct%2Fabcde.html | |
var unescaped = querystring.unescape(escaped); | |
console.log(unescaped); | |
// http://example.com/product/abcde.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment