请url请求转化成obj

var formatQuery=function(query){
var strs=query.split("&");
var theRequest = {};
for(var str in strs){
var p=strs[str].split("=");
theRequest[p[0]] = !theRequest[p[0]] ? p[1] : theRequest[p[0]] + ',' + decodeURI(decodeURI(p[1] || '')).replace(/\+/g, ' ');
}
return theRequest;
};

原文地址:https://www.cnblogs.com/yanypan/p/2844284.html