开发者

Check current domain

开发者 https://www.devze.com 2023-01-28 14:02 出处:网络
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.

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

精彩评论

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