php下过滤HTML代码的函数
2007-12-10 15:14
951 查看
具体如下所示:
/*---------------------- 过滤HTML代码的函数 -----------------------*/ function htmlEncode($string) { $string=trim($string); $string=str_replace("&","&",$string); $string=str_replace("'","'",$string); $string=str_replace("&","&",$string); $string=str_replace(""",""",$string); $string=str_replace("\"",""",$string); $string=str_replace("<","<",$string); $string=str_replace("<","<",$string); $string=str_replace(">",">",$string); $string=str_replace(">",">",$string); $string=str_replace(" "," ",$string); $string=nl2br($string); return $string; }
以上所述是小编给大家介绍的php下过滤HTML代码的函数,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
您可能感兴趣的文章:
相关文章推荐
- php 过滤html标签的函数代码
- php下过滤HTML代码的函数
- php下过滤html代码的函数 提高程序安全性
- php下过滤html代码的函数 提高程序安全性
- php下过滤HTML代码的函数
- PHP 过滤HTML代码空格,回车换行符的函数
- php 过滤html标签的函数代码
- php下过滤html代码的函数
- 比较好用的PHP防注入漏洞过滤函数代码
- php中使用array_filter()函数过滤空数组的实现代码
- 用PHP过滤html里可能被利用来引入外部危险内容的代码
- PHP 清除HTML代码、空格、回车换行符的函数
- php中使用array_filter()函数过滤空数组的实现代码
- PHP 杂谈《重构-改善既有代码的设计》之一 重新组织你的函数【链接:http://www.cnblogs.com/baochuan/archive/2012/03/31/2425441.html】
- php 使用htmlspecialchars() 和strip_tags函数过滤HTML标签的区别
- php过滤危险html代码
- php使HTML标签自动补全闭合函数代码
- php 安全过滤函数代码
- php HtmlReplace输入过滤安全函数
- FpHtmlEnCode 函数之标题过滤特殊符号的代码