[Q&A] 什么是URI?
URI(Uniform Resource Identifier)
统一资源标识符,用来唯一标识互联网上资源的一个字符串。它可以用来定位任何类型的资源,包括网页、图片、文件、视频、服务等。
[Q&A] URI的格式
scheme://host:port/path?query_string#fragment_id
# Scheme(协议):如http、https、ftp、mailto等。
# Authority(权威信息):包括主机名、端口号和用户名密码(可选)
# Path(路径):指向资源在服务器上的位置
# Query(查询参数):附加在路径后面,用于传递额外参数
# Fragment(片段标识符):用于指向资源内的特定部分,仅在本地客户端解析.
https://user:password@example.com:8080/articles/my-article?category=tech&sort=date#section1
# Scheme: https
# Authority: user:password@example.com:8080
# Path: /articles/my-article
# Query: category=tech&sort=date
# Fragment: section1
[Q&A] URI包括了URL和URN两种形式
# URL(Uniform Resource Locator):不仅唯一标识了资源,还提供了资源的具体访问路径。
# 例如:https://www.example.com/articles/123?category=tech&sort=date#comments
# URN(Uniform Resource Name):统一资源名称,而不关心资源当前的位置。
# 例子:urn:oasis:names:specification:docbook:dtd:xml:4.1.2