Open jeffsui opened 2 years ago
const urlStr = 'https://www.baidu.com:443/ad/index.html?id=8&name=mouse#tag=110' // const parseUrl = url.parse(urlStr) #nodejs 11后被废弃 const parseUrl = new URL(urlStr); console.log(parseUrl.searchParams.get('id')); console.log(parseUrl.searchParams.get('name'));
解析url中请求参数