【问题标题】:Kohana or Mustache can not render new line <br/>?Kohana 或 Mustache 无法渲染新行 <br/>?
【发布时间】:2013-01-24 07:39:40
【问题描述】:

我使用 Kohana 3 + Kostache(用于 Kohana 插件的 Mustache)。 在某些时候我创建了字符串:

$addStr .= "<br/>";
$addStr .= $sumrow['name'].": ".$sumrow['counter'];

然后将字符串放入表中。然后该表由 Mustache 呈现。不幸的是,&lt;br/&gt; 标签无法正确呈现,而是呈现为常规文本(&amp;lt;&amp;gt;)。

有没有办法强制 Mustache 或 Kohana 不转义标签而只渲染它们?

【问题讨论】:

    标签: html kohana newline mustache


    【解决方案1】:

    我终于明白了。我必须将 {{{addStr}}} 放入我的 .mustache 模板文件中。

    【讨论】:

    • 我会小心这一点,因为它还允许人们将 javascript 注入变量中。 (假设变量来自用户输入?)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-18
    • 2015-11-30
    • 2012-05-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多