【问题标题】:Smarty error: modifier 'unescape' is not implementedSmarty 错误:未实现修饰符“unes​​cape”
【发布时间】:2015-04-25 19:47:30
【问题描述】:

我想让 smarty 显示 html 变量内容,就像它是 html 文件的一部分一样,所以我使用“unes​​cape”修饰符,就像它是 show here:

<div id="add">{if $add}{$add|unescape:"html"}{/if}</div>

但我明白了:

Fatal error: Smarty error: [in xxx.html line 20]: [plugin] modifier 'unescape' is not implemented (core.load_plugins.php, line 118) in
XXX/inc/lib/Smarty/Smarty.class.php on line 1095

我的插件目录在正确的位置:

Smarty$ ls
Config_File.class.php  Smarty.class.php  Smarty_Compiler.class.php  debug.tpl  error_log  internals  plugins

可能出了什么问题,我该如何做我想做的事?

【问题讨论】:

    标签: php html smarty


    【解决方案1】:

    尝试通过 php 处理它:

    <div id="add">
        {if $add}
            {php}
                echo html_entity_decode($add);
            {/php}
        {/if}
    </div>
    

    您可以使用html_entity_decode 功能来满足您的需求,或者您可以使用htmlspecialchars_decode() 或mb_convert_encoding() 作为Smarty unascape 功能建议。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多