关系如下:
url.parse(string).query
|
url.parse(string).pathname |
| |
| |
------ -------------------
http://localhost:8888/start?foo=bar&hello=world
--- -----
| |
| |
querystring(string)["foo"] |
|
querystring(string)["hello"]
pathname不包括query string,
http://localhost:8888/start
的pathname为/start.注意有斜线。
访问http://localhost:8888
的pathname为/.
原文:http://www.cnblogs.com/youxin/p/3954740.html