java过滤防止sql注入过滤


/**
* 过滤特殊字符
* @author: Simon
* @date: 2017年8月31日 下午1:47:56
* @param str
* @return
*/
public static String StringFilter(String str){
str = str.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
str = str.replaceAll("\\(", "&#40;").replaceAll("\\)", "&#41;");
str = str.replaceAll("'", "&#39;");
str = str.replaceAll("eval\\((.*)\\)", "");
str = str.replaceAll("[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']", "\"\"");
str = str.replaceAll("script", "");
return str;
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM