Check current domain
How do I know address of opened site?
My site supports multiple domains on one folder, I have to give a different content correspond开发者_JAVA技巧ing to domain.
Like, if we are on site http://site.net/
:
$string = 1;
Or, if we are on site http://site.com/
:
$string = 2;
Thanks.
http://www.php.net/manual/en/reserved.variables.server.php
Use $_SERVER['HTTP_HOST']
.
if (strstr($_SERVER['SCRIPT_URI'],'site.net'))
{
$string = 1;
}
if (strstr($_SERVER['SCRIPT_URI'],'site.com'))
{
$string = 2;
}
精彩评论