获取客户端IP公共类代码
<?php/** * @name IpHelper * @desc Ip * @author */class IpHelper { /** * 获取用户真实IP * @return $onlineIp */ public static function getOnlineIp() { if (getenv('HTTP_CLIENT_IP')) { $onlineIp = getenv('HTTP_CLIENT_IP'); } elseif (getenv('HTTP_X_FORWARDED_FOR')) { $onlineIp = getenv('HTTP_X_FORWARDED_FOR'); } elseif (getenv('REMOTE_ADDR')) { $onlineIp = getenv('REMOTE_ADDR'); } else { $onlineIp = 'unknown'; } return $onlineIp; }}