【发布时间】:2010-12-03 16:26:48
【问题描述】:
我如何知道已打开网站的地址?
我的站点在一个文件夹中支持多个域,我必须给不同的内容对应域。
如果我们在现场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;
}
【讨论】: