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'])
精彩评论