const url = require("url");
var u = "https://www.jd.com:443/ad/index?uname=qd";
//将url解析js对象
var obj = url.parse(u);
console.log(obj);
//true:指定querystring.parse 对URL查询字符串进一步
var obj2 = url.parse(u,true);
console.log(obj2);
时间: 2024-10-02 04:28:00
const url = require("url");
var u = "https://www.jd.com:443/ad/index?uname=qd";
//将url解析js对象
var obj = url.parse(u);
console.log(obj);
//true:指定querystring.parse 对URL查询字符串进一步
var obj2 = url.parse(u,true);
console.log(obj2);