当前位置: 移动技术网 > IT编程>开发语言>Asp > asp中格式化HTML函数代码 SDCMS加强版

asp中格式化HTML函数代码 SDCMS加强版

2017年12月08日  | 移动技术网IT编程  | 我要评论
复制代码 代码如下:

'==============================
'格式化html,sdcms加强版
'==============================
function nohtml(byval t0)
if len(t0)=0 or isnull(t0) then
nohtml=""
exit function
end if
dim regs,matches,match
set regs=new regexp
regs.ignorecase=true
regs.global=true
'过滤掉js,iframe
regs.pattern ="<script.+?/script>"
t0=regs.replace(t0,"")
regs.pattern ="<iframe.+?/iframe>"
t0=regs.replace(t0,"")
'再过滤其他
regs.pattern="<.+?>"
set matches=regs.execute(t0)
if matches.count>0 then
for each match in matches
t0=replace(t0,match.value,"")
next
end if
t0=replace(t0," ","")
t0=replace(t0,vbcrlf,"")
t0=replace(t0," ","")
t0=replace(t0," ","")
t0=replace(t0,chr(9),"")
t0=replace(t0,chr(13),"")
t0=replace(t0,chr(10),"")
t0=replace(t0,chr(22),"")
set regs=nothing
nohtml=t0
end function

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网