取url地址参数
作者:互联网
let 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 < arr.length; i++) { obj[arr[i].split('=')[0]] = arr[i].split('=')[1]; } 执行后这里的obj = {param:'123',
param2:'second'}
let arr = url.split('&'); let obj = new Object(); for (var i = 0; i < arr.length; i++) { obj[arr[i].split('=')[0]] = arr[i].split('=')[1]; } 执行后这里的obj = {param:'123',
param2:'second'}
标签:arr,obj,url,second,地址,let,param2,参数 来源: https://www.cnblogs.com/wangxiaoer5200/p/12053607.html