全局关闭转义
在视图配置文件夹中去除默认的过滤方法。
config\view.php
1 | 'default_filter' => '', |
通过 raw 函数防止转义
在模板的函数变量解析代码中,会判断是否存在 raw
,如果不存在会加上默认的过滤方法。
vendor\topthink\think-template\src\Template.php
1 | if (!$autoescape && false === strpos($varStr, '|')) { |
1 | <div class="content"> |