Closed conero closed 5 years ago
由于业务需求,需要通过配置将 html 文本渲染为真正的 HTML而非文本。我知道这种方式是一种不安全的方法,不过当下的业务需要这样做。看了一下 TP5.0 的文档,没有发现相关的解决方案!因此问一下,有没有这样的解决方法!
HTML
文本
尝试过:
php <?php class A ...{ function index(){ .... $this->assign('html_str', '<p><span>many words.</span></p>'); .... } } 模板 .... <body> {$html_str} <!-- raw 方法不存在--> {$html_str | raw}
php
<?php class A ...{ function index(){ .... $this->assign('html_str', '<p><span>many words.</span></p>'); .... } }
模板
.... <body> {$html_str} <!-- raw 方法不存在--> {$html_str | raw}
{php} echo $html_str; {php}
....
It's a bad issue.
由于业务需求,需要通过配置将 html 文本渲染为真正的
HTML
而非文本
。我知道这种方式是一种不安全的方法,不过当下的业务需要这样做。看了一下 TP5.0 的文档,没有发现相关的解决方案!因此问一下,有没有这样的解决方法!尝试过:
{php} echo $html_str; {php}