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

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

WBOY
Release: 2016-06-13 12:12:23
Original
1443 people have browsed it

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

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

------解决思路----------------------
<br />echo explode('.',$_SERVER['HTTP_HOST'])[0];<br />
Copy after login

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