Example #1
0
 /**
  * 获取客户端IP
  * @method getIP
  * @return array [请求的ip,头信息中ip]
  * @author NewFuture
  */
 public static function getIP()
 {
     if (null == self::$_ip) {
         $request_ip = getenv('REMOTE_ADDR');
         $orign_ip = getenv('HTTP_X_FORWARDED_FOR') ?: getenv('HTTP_CLIENT_IP');
         self::$_ip = [ip2long($request_ip), ip2long($orign_ip)];
     }
     return self::$_ip;
 }