public String mobile(HttpServletRequest request, HttpServletResponse response) { String userAgent = request.getHeader("User-Agent"); if(userAgent != null) { if(userAgent.toLowerCase().indexOf("iphone") > -1) { return "苹果手机"; } else if(userAgent.toLowerCase().indexOf("micromessenger") > -1) { return "微信"; } else if(userAgent.toLowerCase().indexOf("android") > -1) { return "android手机"; } } return ""; }