Home >Backend Development >PHP Tutorial >我想用PHP $_SERVER['HTTP_HOST'] 获取当前服务器的域名,但是每次都转换成了IP地址?

我想用PHP $_SERVER['HTTP_HOST'] 获取当前服务器的域名,但是每次都转换成了IP地址?

WBOY
WBOYOriginal
2016-06-06 20:35:582616browse

我想用PHP $_SERVER['HTTP_HOST'] 获取当前服务器的域名,但是每次都转换成了IP地址?

回复内容:

我想用PHP $_SERVER['HTTP_HOST'] 获取当前服务器的域名,但是每次都转换成了IP地址?

看官方文档上说,$_SERVER这个变量是web服务器提供的,所以建议检查一下web服务器的问题

另:http://blog.csdn.net/fz04003/article/details/6115247

请求的url是域名还是ip呢

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