示例#1
0
文件: env.inc.php 项目: tjuwhs/Dola
 public static function getIP()
 {
     if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
         $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
         $ip = $ips[0];
     } else {
         if (!empty($_SERVER['HTTP_CLIENTIP'])) {
             $ip = $_SERVER['HTTP_CLIENTIP'];
         } else {
             if (!empty($_SERVER['REMOTE_ADDR'])) {
                 $ip = $_SERVER['REMOTE_ADDR'];
             } else {
                 $ip = '127.0.0.1';
             }
         }
     }
     self::$remoteIP = $ip;
     return self::$remoteIP;
 }