Twig 将标签包含在细枝中不工作,;Run是空的
我不知道它是否工作。服务器环境:Twig 将标签包含在细枝中不工作,;Run是空的,twig,Twig,我不知道它是否工作。服务器环境: Twig:3.0 PHP:7.X nginx:1.15.11 {{include'include/header.html} 模板文件: |-index.html |-content.html |-Include |- head.html |- footer.html index.php: $loader = new Twig_Loader_Filesystem(ROOT_PATH.'/Templates'); $twig = new Twi
Twig:3.0
PHP:7.X
nginx:1.15.11
{{include'include/header.html}
模板文件:
|-index.html
|-content.html
|-Include
|- head.html
|- footer.html
index.php:
$loader = new Twig_Loader_Filesystem(ROOT_PATH.'/Templates');
$twig = new Twig_Environment($loader, [
'cache' => ROOT_PATH.'/Cache',
'auto_reload' => true,
'debug' => true
]);
echo $twig->render('index.html');
index.html:
{{ include 'Include/head.html' }}
<article>
body
<article>
{{ include 'Include/footer.html' }}
{{include'include/head.html}
身体
{{include'include/footer.html'}
它不起作用,页面是空白的。首先,如果在dev中,请尝试注释
'cache' => ROOT_PATH.'/Cache',
然后是打字错误
{{ include 'Include/foother.html' }}
到
我建议您尝试先不包含任何子细枝,然后先渲染简单的1个细枝。如果成功,则只需包含并重试。这是
{%include…%}
而不是{{include…}
您有标题
和标题
,您应该事先清除它。{%include'include/head.html%}不起作用:(应按预期工作。请参阅。确保启用了错误报告
和显示错误
,这样也会显示小树枝错误,尽管有关键入的备注是正确的,或者使用了不正确的语法
{{ include 'Include/footer.html' }}