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

WBOY
Release: 2016-06-13 13:01:00
Original
886 people have browsed it

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

<?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 />
}
Copy after login



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

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!