标签:
1 var url = require(‘url‘); 2 var a = url.resolve(‘/one/two/three‘, ‘four‘) , 3 b = url.resolve(‘http://example.com/‘, ‘/one‘), 4 c = url.resolve(‘http://example.com/one‘, ‘/two‘); 5 console.log(a +","+ b +","+ c); 6 //输出结果: 7 ///one/two/four 8 //http://example.com/one 9 //http://example.com/two
注意总结用法规律;
替换 域名后面第一个“/”后的内容;
标签:
原文地址:http://www.cnblogs.com/suoking/p/5036098.html