On the WWW, every information resource has a unified and unique address on the Internet. This address is called a URL (Uniform Resource Locator, Uniform Resource Locator). It is the unified resource locator of WWW, which refers to the network address. (Recommended learning: phpstorm)
URL consists of three parts: resource type, host domain name where the resource is stored, and resource file name.
can also be considered to be composed of 4 parts: protocol, host, port, path
The general syntax format of URL is:
( Those with square brackets [] are optional):
protocol :// hostname[:port] / path / [;parameters][?query]#fragment
protocol
Specifies the transmission protocol used. The following table lists the valid scheme names for the protocol attribute. . The most commonly used protocol is HTTP, which is also the most widely used protocol in the WWW.
hostname
is the Domain Name System (DNS) hostname or IP address of the server where the resource is stored. Sometimes, the hostname can also be preceded by the username and password required to connect to the server (format: username:password@hostname).
port (port number)
Integer, optional, when omitted, the default port of the scheme is used. Various transmission protocols have default port numbers, such as http The default port is 80. If omitted on entry, the default port number is used. Sometimes for security or other considerations, the port can be redefined on the server, that is, a non-standard port number can be used. In this case, the port number cannot be omitted in the URL.
path (path)
A string separated by zero or more "/" symbols, generally used to represent a directory or file address on the host.
parameters
This is an optional option for specifying special parameters.
query(query)
Optional, used for dynamic web pages (such as those produced using CGI, ISAPI, PHP/JSP/ASP/ASP.NET and other technologies Web page) to pass parameters, there can be multiple parameters, separated by the "&" symbol, and the name and value of each parameter are separated by the "=" symbol.
fragment (information fragment)
String, used to specify the fragment in the network resource. For example, if there are multiple noun explanations in a web page, you can use fragment to directly locate a certain noun explanation.
The above is the detailed content of The composition format of url is. For more information, please follow other related articles on the PHP Chinese website!