php获得本机ipv4地址

if (isset($_ENV["HOSTNAME"]))
$MachineName = $_ENV["HOSTNAME"];
else if (isset($_ENV["COMPUTERNAME"]))
$MachineName = $_ENV["COMPUTERNAME"];
else $MachineName = "";
echo gethostbyname($MachineName);

posted on 2015-03-26 15:55  liuwenbohhh  阅读(477)  评论(0编辑  收藏  举报