开发者

Getting computer name, computer's Local ip and computer's server ip using php

开发者 https://www.devze.com 2023-02-22 03:02 出处:网络
How do I get computer name, computer\'s Local IP (if it is using LAN) and computer\'s server IP (LAN\'s Server IP) using P开发者_如何转开发HP.Server IP: $_SERVER[\'SERVER_ADDR\']

How do I get computer name, computer's Local IP (if it is using LAN) and computer's server IP (LAN's Server IP) using P开发者_如何转开发HP.


Server IP: $_SERVER['SERVER_ADDR']

Computer name: You can't get that.

Local ip will be $_SERVER['REMOTE_ADDR'] if you are on a local server.

This is the list of available $_SERVER vars: http://php.net/manual/en/reserved.variables.server.php


I think they should all be in the $_SERVER superglobal.

All covered here: http://php.net/manual/en/reserved.variables.server.php


I use this one:

gethostbyaddr($_SERVER['REMOTE_ADDR'])
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号