Home  >  Article  >  Backend Development  >  帮忙看上这段代码是什么意思

帮忙看上这段代码是什么意思

WBOY
WBOYOriginal
2016-06-13 11:09:48803browse

帮忙看下这段代码是什么意思?

<?php<br /><br />$host = $_SERVER['HTTP_HOST'];<br />$host = substr($host, 0, strpos($host, '.123.baidu.com'));<br /><br />if(!empty($host))<br />{<br />	include('task.php');<br />}<br />else<br />{<br />	include('click.php');<br />}



这段代码是什么意思呢?没太看懂
获取主机头
第二句然后是删除".123.baidu.com" 还是说 得到什么?
下面的if也没看懂,if(!empty($host))   如果 host为空? 就执行task.php 否则执行 click.php
是这样吗?
------解决方案--------------------
第二句然后是删除".123.baidu.com" 还是说 得到什么?
---- 是的,你echo $host; 就知道了

下面的if就很简单了吧,其实就是判断是否为三级域名

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