@GivenCui
        
        2016-12-28T02:45:00.000000Z
        字数 1718
        阅读 874
    node
命令行: node // 进入node环境
url // url对象及方法属性
{ parse: [Function: urlParse],resolve: [Function: urlResolve],resolveObject: [Function: urlResolveObject],format: [Function: urlFormat],URL:{ [Function: URL]originFor: [Function],domainToASCII: [Function],domainToUnicode: [Function] },Url: [Function: Url]}
url.parse('https://www.baidu.com:8080/index/index.html?name=123&age=456#test1');// 第2个参数,query是否解析成query对象url.parse('https://www.baidu.com:8080/index/index.html?name=123&age=456#test1', true);// 第3个参数 不指定协议时或不明确协议时url.parse('//www.baidu.com:8080/index/index.html?name=123&age=456#test1', true, true);/*Url {protocol: 'https:',slashes: true,auth: null,host: 'www.baidu.com:8080',port: '8080',hostname: 'www.baidu.com',hash: '#test1',search: '?name=123&age=456',query: 'name=123&age=456',pathname: '/index/index.html',path: '/index/index.html?name=123&age=456',href: 'https://www.baidu.com:8080/index/index.html?name=123&age=456#test1' }?? www.baidu.com 和 baidu.com*/
{ unescapeBuffer: [Function],unescape: [Function: qsUnescape], // 参数解码escape: [Function], // 参数编码encode: [Function], // 同stringify (对象 --> 字符串)stringify: [Function], // 序列化 (对象 --> 字符串)decode: [Function], // 同parse (字符串 --> 对象)parse: [Function] // 解析(反序列化) (字符串 --> 对象)}
// querystring.stringify({query对象},&替换符,=替换符)// querystring.stringify({name:'scott',course:['jade','node'],teacher:'LiHuan'})// querystring.stringify({name:'scott',course:['jade','node'],teacher:'LiHuan'},',')// querystring.stringify({name:'scott',course:['jade','node'],teacher:'LiHuan'},',',':')
// querystring.stringify({query字符串},&替换符,=替换符)// 对应stringify也有三个参数
