/** * 判断请求是否手机端 * @param req * @return */ public static boolean isMobile(HttpServletRequest req) { UserAgent ua = UserAgent.parseUserAgentString(req.getHeader("User-Agent")); OperatingSystem os = ua.getOperatingSystem(); if(DeviceType.MOBILE.equals(os.getDeviceType())) { return true; } return false; }
时间: 2024-10-07 08:09:01