开发者

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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜