取url地址参数
2021-05-11 15:28
阅读:582
标签:cond nbsp 地址 ref obj length amp sts split 取url地址参数 标签:cond nbsp 地址 ref obj length amp sts split 原文地址:https://www.cnblogs.com/wangxiaoer5200/p/12053607.htmllet url = ‘https://i-beta.cnblogs.com/posts/edit?param1=123¶m2=second‘
let arr = url.split(‘&‘);let obj = new Object();
for (var i = 0; i
obj[arr[i].split(‘=‘)[0]] = arr[i].split(‘=‘)[1];
}
执行后这里的obj = {param:‘123‘,
param2:‘second‘}
评论
亲,登录后才可以留言!