Home >Backend Development >PHP Tutorial > 帮小弟我看看这个根据主机头来显示内容应该如何修改

帮小弟我看看这个根据主机头来显示内容应该如何修改

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 13:00:17982browse

帮我看看这个根据主机头来显示内容应该怎么修改
比如访问  123.yiqimai.baidu.com
$host = $_SERVER["HTTP_HOST"];   //获取主机头
if($host=="yiqimai.baidu.com")
{
  include("index1.html");  //,输出主页
}
否则 
$host = str_replace('.yiqimai.baidu.com', '', $host );   // 获取三级域名值

include("$host.html");  //输出跟 三级域名值一样的 html文件
?>

不懂php语言,麻烦帮忙修改下
------解决方案--------------------

<br />
<?php<br />
$host = $_SERVER["HTTP_HOST"];   //获取主机头<br />
if($host=="yiqimai.baidu.com"){<br />
  include("index1.html");  //,输出主页<br />
}else{<br />
  include(str_replace('.yiqimai.baidu.com', '', $host ).".html");<br />
}<br />
?><br />

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn