在FatFree中的html模板中呈现字符串

问题描述 投票:1回答:1

我有一个html文件,其中fatfree从.html文件呈现html代码。例如,.html文件包含以下代码;

<include href='navigation.html'>
<include href='{{ @view }}>

其中view包含.html文件的路径。

但在我的情况下,html代码由程序生成为字符串类型。如何在fatfree中将这样的字符串呈现为html。

<div>{{ @view }}</div>
php fat-free-framework
1个回答
1
投票

看看https://fatfreeframework.com/3.6/views-and-templates#Extendingfiltersandcustomtags

您可以使用<div>{{ @view|raw }}</div>使用过滤器来使用原始HTML代码而不是转义(用于安全性)版本。

或者,您可以禁用一般的转义,这是非常不鼓励的。

$f3->set('ESCAPE',FALSE);

© www.soinside.com 2019 - 2024. All rights reserved.