CNode

使用Nunjucks 显示数据时,怎么解析数据中的html标签,求帮助啊

问答
Ppzjyyzs发布于10 年前最后回复10 年前3 回复6567 浏览0 收藏

数据库中的数据:<h1>内容</h1> 在页面中显示![25YG)R`UUI0E8O22I$XEET.png 怎么能够让他解析html标签呢

查看回复

回复 (3)

P
pzjyyzs#1·10 年前
P
pzjyyzs#2·10 年前

啊 可以结了呀 Autoescaping If autoescaping is turned on in the environment, all output will automatically be escaped for safe output. To manually mark output as safe, use the safe filter. Nunjucks will not escape this output.

{{ foo }} // &lt;span%gt; {{ foo | safe }} // <span>

I
i5ting#3·10 年前

https://mozilla.github.io/nunjucks/templating.html

我猜是这个

raw

If you want to output any of the special Nunjucks tags like {{, you can use a {{, you can use a {% raw %} block and anything inside of it will be output as plain text.

参与回复
登录后即可参与回复。登录