直接上代码了:
String ip =
null;
if (request.getHeader("X-Real-IP") ==
null) {
ip = request.getRemoteHost();
} else {
ip = request.getHeader("X-Real-IP");
}
时间: 2024-11-11 11:30:18
直接上代码了:
String ip =
null;
if (request.getHeader("X-Real-IP") ==
null) {
ip = request.getRemoteHost();
} else {
ip = request.getHeader("X-Real-IP");
}