PHP针对HTML实体字符的转义函数
1、htmlspecialchars()转义特别的字符为HTML实体;'&'(a罪焐芡拂mpersand)becomes'&''"'(doublequote)becomes'"'whenENT_NOQUOTESisnotset.'''(singlequote)becomes'''onlywhenENT_QUOTESisset.'<'(lessthan)becomes'<''>'(greaterthan)becomes'>'
2、htmlspecialchars_decode()将实体转成HTML代码,函数1的反函数。
3、htmlentities()这个是全部转换html实体,和htmlspecialchars()区别在于,这个函数是转义全部的字符,而htmlspecialchars()仅仅转义上面限定的5个特殊字符!html_entity_decode() 函数把 HTML 实体转换为字符。
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:49
阅读量:87
阅读量:88
阅读量:89
阅读量:82