URI格式

时间:2022-07-24
本文章向大家介绍URI格式,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
The following figure displays two example URIs (foo://username:password@example.com:8042/over/there/index.dtb?type=animal&name=narwhal#nose and urn:example:animal:ferret:nose) and their component parts. (The examples are derived from RFC 3986 — STD 66, chapter 3).
foo://username:password@example.com:8042/over/there/index.dtb?type=animal&name=narwhal#nose
  _/   _______________/ _________/ __/            ___/ _/ ______________________/ __/
   |           |               |       |                |    |            |                |
   |       userinfo           host    port              |    |          query          fragment
   |    ________________________________/_____________|____|/ __/        __/
 scheme                 |                          |    |    |    |          |
  name              authority                      |    |    |    |          |
   |                                             path   |    |    interpretable as keys
   |                                                    |    |
   |    _______________________________________________|____|/       ____/     _____/
   |                         |                          |    |          |           |
 scheme              hierarchical part                  |    |    interpretable as values
  name                                                  |    |
   |            path               interpretable as filename |
   |   ___________|____________                              |
  /  /                                                     |
  urn:example:animal:ferret:nose               interpretable as extension
                path
         _________|________
 scheme /                  
  name  userinfo  hostname       query
  _|__   ___|__   ____|____   _____|_____
 /     /       /          /           
 mailto:username@example.com?subject=Topic

格式: http://user:pass@www.example.com:80/home/index.html?age=11#mask http:协议方案名 user:pass:登录信息(认证) www.example.com:服务器地址 80:端口号 /hone/index.html:文件路径 age=11:查询字符串 mask:片段标识符 协议方案名: http:、https:、ftp:等,在获取资源时要指定协议类型。 登录信息(认证): 指定用户名和密码作为从服务器端获取资源时必要的登录信息,此项是可选的。 服务器地址: 使用绝对URI必须指定待访问的服务器地址。 服务器端口号: 指定服务器连接的网络端口号,此项是可选的。 路径: 指定服务器上的文件路径来定位特定资源。格式为: /home/index.html 参数: 为应用程序提供访问资源所需的附加信息。 例如:ftp://127.27.27.27/pub/pic;type=d 查询字符串: 针对已指定的文件路径内的资源,可以使用查询字符串传入任意参数,此项是可选的。 片段标识符: 通常可标记出以获取资源中的子资源(文档内的某一个位置),此项是可选的。