过滤html恶意代码
来源:互联网 发布:有哪些php程序 编辑:程序博客网 时间:2024/05/27 09:47
/** * 转义HTML特殊字符 */ public static final String trunhtml(String html){ if(html == null) return null; final StringBuilder newhtml = new StringBuilder(""); final char[] chararray = html.toCharArray(); for(char c : chararray){ if(c == '\r') continue; if(c == '&') newhtml.append("&"); else if(c == '#') newhtml.append("#"); else if(c == '*') newhtml.append("*"); else if(c == ':') newhtml.append(":"); else if(c == ';') newhtml.append(";"); else if(c == '<') newhtml.append("<"); else if(c == '>') newhtml.append(">"); else if(c == ' ') newhtml.append(" "); else if(c == '\n') newhtml.append("<br />"); else if(c == '"') newhtml.append("""); else if(c == '\'') newhtml.append("'"); else if(c == '/') newhtml.append("/"); else if(c == '$') newhtml.append("$"); else if(c == '(') newhtml.append("("); else if(c == ')') newhtml.append(")"); else if(c == '{') newhtml.append("{"); else if(c == '}') newhtml.append("}"); else if(c == '*') newhtml.append("*"); else if(c == '%') newhtml.append("%"); else if(c == '+') newhtml.append("+"); else if(c == '-') newhtml.append("-"); else if(c == '~') newhtml.append("~"); else if(c == '\t') newhtml.append(" "); else newhtml.append(c); } return newhtml.toString(); }
0 0
- 过滤html恶意代码
- 过滤恶意代码图片上传
- 恶意代码
- 恶意代码
- HTML过滤
- 过滤html
- html代码过滤
- HTML代码过滤函数
- 正则表达式 过滤html
- HTML代码过滤技术
- HTML代码过滤技术
- HTML代码过滤技术
- Asp过滤Html代码
- asp过滤html语言
- ASP 过滤 HTML 标签
- 过滤掉 html代码
- 过滤html字符(c#)
- PHP过滤HTML字串
- Linux性能评测工具之一:gprof篇
- hibernate flush 机制与调用 saveOrupdate 后不立即打印 sql 的问题
- javaweb 写mysql数据库中文乱码
- 【Android】熟悉Android Studio以及其快捷键
- MES - 快速开工
- 过滤html恶意代码
- PXC添加新节点只需IST传输的方法
- xml解析数据并上拉加载下拉刷新
- 通用工具类
- 点九图CCScale9Sprite
- SpringMVC学习系列(8) 之 国际化
- 不能远程连接linux的mysql服务器
- Java集合详解系列----Java集合继承体系详解
- OpenCV_(1):Mat结构的应用