function getUrlParam(sUrl, sKey) {
var str = sUrl
var obj = {}
str.replace(/(\&{1}(\w+=\w+))|(\?\w+=\w+)/g, function (e1) {
//获取Key
var k = e1.substring(
1,
e1.indexOf('=')
)
//获取V
var vl = e1.substring(e1.indexOf('=')+1, e1.length)
if (typeof obj[k] === 'string') {
obj[k] = [obj[k]]
obj[k].push(vl)
}
else if (obj[k] == undefined){
obj[k] = vl
}
else {
obj[k].push(vl)
}
})
if (sKey) {
return obj[sKey] ? obj[sKey] : ''
}
return obj
}