Whether the host contains a port or not. $ _ SERVER ['http _ host'] obtains a HOST with a port number. Theoretically, the host is a host name and should not contain a port number.
Reply to discussion (solution)
$ _ SERVER ['http _ host'] does not contain a port number
$ _ SERVER ['server _ port'] is the PORT number.
$ _ SERVER ['http _ host'] does not contain a port number
$ _ SERVER ['server _ port'] is the PORT number.
In this test, if port 80 is not used, $ _ SERVER ['http _ host'] carries a port number.
Take a good look at the global variable $ _ server of php.
Reference link:
Php URL retrieval method (global variable)
Http://www.jbxue.com/article/6798.html
$ _ SERVER ['http _ host'] will contain the HOST header field of the request header in HTTP.
Host header domain
The Host header specifies the Intenet Host and port number of the requested resource, which must represent the location of the original server or gateway of the request url. The HTTP/1.1 request must contain the host header domain; otherwise, the system returns the status code 400.