<script>

let url = "http://witmax.cn/index.php?key0=0&key1=1&key2=2";

let hongdou = url.indexOf("?");   //检索

let str = url.slice(hongdou+1);   //选取

let arr = str.split("&");                //分割

let result =[];

let obj = {};

for(let i=0;i<arr.length;i++){

result = arr[i].split("=");         //分割

obj[result[0]] = result[1];

}

console.log(obj);

</script>

相关文章:

  • 2021-08-30
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-25
猜你喜欢
  • 2021-07-23
  • 2021-09-03
  • 2021-08-24
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案