看起来你试图在配置的目录之外加载模板 (../includeFiles/header.html.twig) Symfony

Looks like you try to load a template outside configured directories (../includeFiles/header.html.twig) Symfony

我正在尝试分离模板,并取出header,并且在连接时

   {{include ('../includeFiles/header.html.twig')}}

在 profile.html.twig 文件中我有这个错误,我检查过,在 twig.yaml 文件中

twig:
     default_path: '% kernel.project_dir% / templates'

这是我的模板层次结构:

模板层次结构的描述

我不明白错误是什么,我将非常感谢解决方案

Twig 不允许在模板名称中使用 ../。你应该使用 Namespaced Twig Paths.