thinkphp过滤html、script

使用tp3.1版本

1、APP/common 自定义函数

function filter_default(&$value){
$value = htmlspecialchars($value);
}

2、config配置默认过滤器

'VAR_FILTERS'=>'filter_default,filter_exp'

参见

http://www.thinkphp.cn/document/308.html

3、显示时使用 &lt; - > '<' 则使用

{$vo.content|htmlspecialchars_decode}

参见

http://blog.csdn.net/losetowin/article/details/7292709

原文地址:https://www.cnblogs.com/yun007/p/3672767.html