怎样避免sql危险字符注入
避免sql危险字符注入的方法:
将危险字符替换掉,代码示例以下:
public class Checkstr {
public String dostring(String str){
str=str.replaceAll(";","");
str=str.replaceAll("&","&");
str=str.replaceAll("<","<");
str=str.replaceAll(">",">");
str=str.replaceAll("'","");
str=str.replaceAll("--","");
str=str.replaceAll("/","");
str=str.replaceAll("%","");
return str;
}
}
本文来源:https://www.yuntue.com/post/62276.html | 云服务器网,转载请注明出处!

微信扫一扫打赏
支付宝扫一扫打赏