pppp
(php编程)
高级会员

老会员
UID 19770
精华
0
积分 552
帖子 566
金钱 552 喜悦币
威望 0
人脉 0
阅读权限 50
注册 2003-4-21
状态 离线
|
[广告]: Enom域名自助付费 自助注册 自助PUSH 主流域名COM等一律57.99元年
先在php中过滤后再入库.
下面输出:
function HTMLEncode(text){
text = text.replace(/&/g, "&") ;
text = text.replace(/"/g, "\"") ;
text = text.replace(/</g, "<") ;
text = text.replace(/>/g, ">") ;
text = text.replace(//g, "'") ;
text = text.replace(/ /g,"\ ");
text = text.replace(/<br>/g,"\n");
text = text.replace(/ /g,"\t");
text = text.replace(/<\/?SPAN[^>]*>/gi, "" );
text = text.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
text = text.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3") ;
text = text.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
text = text.replace(/<\\?\?xml[^>]*>/gi, "") ;
text = text.replace(/<\/?\w+:[^>]*>/gi, "") ;
text = text.replace(/ /, " " );
text = text.replace(/<[^>]*>/gi, "") ;
return text;
}
|
|