echo "当前脚本服务器的主机名:".gethostbyaddr($_SERVER['REMOTE_ADDR'])."
"; echo "获得当前运行PHP脚本(页面)所在的服务器的 IP 地址:".$_SERVER['SERVER_ADDR']."
"; echo "获得当前运行PHP脚本(页面)所在的服务器的 主机名:".$_SERVER['SERVER_NAME']; echo '
'; echo '客户端ip'. $_SERVER['REMOTE_ADDR']; echo '
'; echo '客户端ip'.getenv('REMOTE_ADDR'); echo "
"; echo '服务器主机ip'.gethostbyname("www.qq.com"); ?>Run it out:
The host name of the current script server: XYL-PC
Get the IP address of the server where the PHP script (page) is currently running: 127.0.0.1
Get the host name of the server where the PHP script (page) is currently running: localhost
Client ip127.0.0.1
Client ip127.0.0.1
Server host ip61.135.169.105