1. 首先定义一个工具类,增加一个方法判断请求是否来自手机:
package util;
/**
* @Description: 识别来源手机或电脑请求工具类
* @Aouthor:jin gang
* @Date:2020/9/12 11:08
*/
public class StringUtil {
// 定义移动端请求的所有可能类型
private final static String[] agent = {
"Android","iPhone","iPod","Windows Phone","MQQBrowser"};
public static boolean checkAgentIsMobile(String ua){