我如何知道打開網站的地址?查看當前域名
我的網站在一個文件夾上支持多個域名,我必須給出與域名相對應的不同內容。
一樣,如果我們都在現場http://site.net/
:
$string = 1;
或者,如果我們都在現場http://site.com/
:
$string = 2;
感謝。
我如何知道打開網站的地址?查看當前域名
我的網站在一個文件夾上支持多個域名,我必須給出與域名相對應的不同內容。
一樣,如果我們都在現場http://site.net/
:
$string = 1;
或者,如果我們都在現場http://site.com/
:
$string = 2;
感謝。
使用$_SERVER['HTTP_HOST']
。
if (strstr($_SERVER['SCRIPT_URI'],'site.net'))
{
$string = 1;
}
if (strstr($_SERVER['SCRIPT_URI'],'site.com'))
{
$string = 2;
}