登录

用户名:

密码:
过滤html代码的htmlencode函数     
作者:nsr131421
发部日期:Wed, 01/10/2007

// 过滤html代码
function htmlencode(fstring) {
    fstring = replacenocase(fstring,'>','>','all');
    fstring = replacenocase(fstring,'<','&lt;','all');
    fstring = replacenocase(fstring,chr(32),'&nbsp;','all');
    fstring = replacenocase(fstring,chr(9),'&nbsp;','all');
    fstring = replacenocase(fstring,chr(34),'&quot;','all');
    fstring = replacenocase(fstring,chr(39),'&acute;','all');
    fstring = replacenocase(fstring,chr(10),'<br />','all');
    return fstring;

 

示例:
<cfoutput>
    <cfset html = "<JustTest>">
    #htmlencode(html)#
</cfoutput>

最后更新:Wed, 01/10/2007