JS10 -- url问号后的数据

www.xiaoheikeji.net?open_id=12spa

function GetQueryString(name)
{
  let reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
  let r = window.location.search.substr(1).match(reg);
  if(r!=null)return unescape(r[2]); return null;
}.net

GetQueryString('open_id')          // 12io

相关文章
相关标签/搜索