Answer the question
In order to leave comments, you need to log in
Why doesn't $_SERVER['SERVER_NAME'] return everything?
I am writing a router, I ran into the following problem:
when trying to return a subdomain, the function for some reason returns the main domain, but it does not see the subdomain. That is, when you try to do this on a site like: sub.domain.com
$sub = explode('.', $_SERVER['SERVER_NAME']);
echo $sub[0];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question