获取ip
public static String getClientIp() { HttpServletRequest request = HttpKit.getRequest(); String ip = request.getHeader("x-forwarded-for"); if (ip == null) { ip = request.getRemoteAddr(); } String[] ipArrays = ip.split(","); return ipArrays.length > 0 ? ipArrays[0] : ip; }
随笔看心情