【问题标题】:Check current domain检查当前域
【发布时间】:2010-12-03 16:26:48
【问题描述】:

我如何知道已打开网站的地址?

我的站点在一个文件夹中支持多个域,我必须给不同的内容对应域。

如果我们在现场http://site.net/:

$string = 1;

或者,如果我们在现场http://site.com/

$string = 2;

谢谢。

【问题讨论】:

    标签: php dns


    【解决方案1】:
    【解决方案2】:

    使用$_SERVER['HTTP_HOST']

    【讨论】:

      【解决方案3】:
      if (strstr($_SERVER['SCRIPT_URI'],'site.net'))
      {
          $string = 1;
      }
      if (strstr($_SERVER['SCRIPT_URI'],'site.com'))
      {
          $string = 2;
      }
      

      【讨论】:

        猜你喜欢
        • 2017-09-02
        • 1970-01-01
        • 2020-01-21
        • 2010-10-12
        • 2021-09-13
        • 1970-01-01
        • 1970-01-01
        • 2019-03-27
        • 1970-01-01
        相关资源
        最近更新 更多