几个开发小问题解决方案

150 阅读1分钟

使用@RequestBody接收数据乱码

需要将练吗数据解码之后转化为char后在转化为string

string s= URLDecoder.decode(PlatFormID, "UTF-8")
  private static String revert(String s){
        char[] chars = s.toCharArray();
        byte[] bytes = new byte[chars.length];

        for(int i = 0; i < chars.length; i++){
            bytes[i] = (byte) chars[i];
        }

        //如系统非使用UTF-8编码,请替换为带有编码格式的构造函数
        return new String(bytes);
    }

使用返回的新值即可

js中使用文件的lastModifyDate在iOS设备上不兼容

替换为如下lastModified

		var img = this.files[0];//得到图片文件
		var dt = img.lastModified

在低版本安卓系统中因为某种情况无法加载js

最后查明,是在js中使用了es6的写法。将这种写法去掉就可以了