<?php
function getServerAddress() {
if($_SERVER['SERVER_ADDR']) {
return $_SERVER['SERVER_ADDR'];
}
$ifconfig = shell_exec('/sbin/ifconfig eth0');
preg_match('/addr:([\d\.]+)/',$ifconfig,$match);
return $match[1];
}
?>
复制代码 代码如下: