Home  >  Article  >  What does the content of the url include?

What does the content of the url include?

尚
Original
2019-07-23 14:24:0518815browse

What does the content of the url include?

On the WWW, each information resource has a unified and unique address on the Internet. This address is called URL (Uniform Resource Locator, Uniform Resource Locator), which is WWW The Uniform Resource Locator indicates the network address.

URL consists of three parts: resource type, host domain name where the resource is stored, and resource file name.

The general syntax format of URL is:

(with square brackets [] is optional):

protocol ://hostname[:port] / path / [;parameters][?query]#fragment

1. Mode/protocol (scheme): It tells the browser how to handle the file to be opened. The most commonly used mode is the Hypertext Transfer Protocol (HTTP), which is used to access the Internet. Other protocols are as follows:

  http——超文本传输协议资源
  https——用安全套接字层传送的超文本传输协议
  ftp——文件传输协议
  mailto——电子邮件地址
  ldap——轻型目录访问协议搜索
  file——当地电脑或网上分享的文件
  news——Usenet新闻组
  gopher——Gopher协议
  telnet——Telnet协议


2. The name or IP address of the server where the file is located, followed by the path to the file and the name of the file itself. The server name or IP address is sometimes followed by a colon and a port number. It may also contain the username and password required to contact the server. The path part contains the path definition of the hierarchical structure. Generally, different parts are separated by slashes (/). The query part is generally used to transmit the parameters required for dynamic query of the database on the server.

Example:

Assume this is a url address http://localhost:8080/a/b/c?a=1&b=2#abc, which contains:

protocol: 'http:',//协议
host: 'localhost:8080',
port: '8080',//端口
hostname: 'localhost',域名
hash: '#abc',
search: '?a=1&b=2' 等于 ?query: 'a=1&b=2',
pathname: '/a/b/c',
path: '/a/b/c?a=1&b=2',
href: 'http://localhost:8080/a/b/c?a=1&b=2#abc'

The above is the detailed content of What does the content of the url include?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What does telnet mean?Next article:What does telnet mean?