URI结构

[scheme:][//host:port][path][?query][#fragment]  

path:从端口后第一个/开始,可以有多个,每个用/连接。

query:第一个?开始,至行尾或#结束。参数可以带值,也可以不带,多个参数用&连接。

fragment:#为开始,行尾为结束。

可以省略某些组件,但必须严格遵守上述顺序。例如react-router中:http://localhost:8080/#/repos?_k=hh400d中,search为空,后面?_k=hh400d的部分仍为hash的组成部分,只是在react内部传递参数。

URI完整结构:

foo://username:password@example.com:8042/over/there/index.dtb?type=animal&name=narwhal#nose
_/ \________________/ \_________/ \__/\____________________/\____________________/ \__/
 |           |              |        |            |                      |            |
scheme   userinfo          host     port         path                  query       fragment                                      
name
以上皆为个人理解,如有错误之处,欢迎留言指正。
原文地址:https://www.cnblogs.com/kevin2chen/p/6386235.html