Analysis of url
hj.nm.google.com
How to you look at hj.nm
,is it 开发者_如何学Goa server named hj.nm
?
$_SERVER['SERVER_NAME']
be?)In reality:
hj
is a subdomain of nm.domain.name
nm
is a subdomain of domain.name
domain
is a subdomain (technically) of name
In PHP:
$_SERVER['SERVER_NAME']
in this case might be hj.nm.domain.name
This variable can be defined as anything if running on a virtual host
If you reliably want the web address your PHP script is running at, I believe you can use $_SERVER['HTTP_HOST'];
could be anything really, but subdomains could be usernames in the DB or, an arbitrary name to separate it from www.domain.name.
so no, it's not necessarily a server named hj.nm
You can basically look at it in reverse:
- com - root name
- google - domain of root name
- nm - sub domain of "google"
- hj - sub domain of "nm"
As to the physical implementation, you cannot tell from the name given. It is possible to host com, google.com, nm.google.com, and hj.nm.google.com all on the same server as well as hosting hj.nm.google.com on more than one server.
精彩评论