SOURCE

var url = 'http://www.domain.com/?user=anonymous&id=123&id=456&id=okc&city=%E5%8C%97%E4%BA%AC&d&enabled';
function parserUrl(url){
    var str = url.split('?')[1].split('&');
    
    var params = {};

    for(var i = 0; i < str.length; i++){
        var item = str[i].split('=');
     
        if(item[1] === undefined){
            item[1] = true
        }
        if(item[1][0] === '%'){
            item[1] = decodeURIComponent(item[1])
        }
        if(item[0] in params){
            if(Array.isArray(params[item[0]])){
                params[item[0]].push(item[1])
            }else{
                params[item[0]] = [params[item[0]], item[1]]
            }
        }else{
            params[item[0]] = item[1]
        }
    }
    return params;
}
parserUrl(url)
console 命令行工具 X clear

                    
>
console