Home >Backend Development >PHP Tutorial >怎么获取主机头在页面中显示

怎么获取主机头在页面中显示

WBOY
WBOYOriginal
2016-06-13 12:12:231439browse

如何获取主机头在页面中显示?
列:
打开http://111.xxx.com/index.php在当前页面中只显示“111
如果打开的是http://2893.xxx.com/index.php 页面中显示的是”2893
这个用什么代码获取呢?
------解决思路----------------------

echo strtok($_SERVER["HTTP_HOST"], '.');

------解决思路----------------------
<br />echo explode('.',$_SERVER['HTTP_HOST'])[0];<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