October CMS 中的输出变量会自动转义,|raw 过滤器将该值标记为“安全”,并且如果 raw 是应用的最后一个过滤器,则不会被转义。
{# This variable won't be escaped #}
{{ variable|raw }}在使用表达式内部的 raw 过滤器时请小心:
{% set hello = '<strong>Hello</strong>' %}
{% set hola = '<strong>Hola</strong>' %}
{{ false ? '<strong>Hola</strong>' : hello|raw }}
{# The above will not render the same as #}
{{ false ? hola : hello|raw }}
{# But renders the same as #}
{{ (false ? hola : hello)|raw }}