Twig_Error_Loader目录不存在

时间:2017-01-04 10:32:40

标签: php codeigniter twig

我想更改树枝的渲染路径。我正在使用带有codeigniter的树枝。我的代码如下:

$loader = new Twig_Loader_Filesystem(FCPATH.'themes/site/default');
$twig = new Twig_Environment($loader);
$twig->load('layout.twig.php');
echo $twig->render(APPPATH.'views/site/welcome.twig.php', $data);

但是代码给出了错误:

Type: Twig_Error_Loader

Message: Unable to find template "/var/www/html/test.ab/application/views/site/welcome.twig.php" (looked into: /var/www/html/test.ab/themes/site/default).

Filename: /var/www/html/test.ab/vendor/twig/twig/lib/Twig/Loader/Filesystem.php

Line Number: 232

1 个答案:

答案 0 :(得分:0)

$loader = new Twig_Loader_Filesystem(FCPATH.'themes/site/default'); $twig = new Twig_Environment($loader); echo $twig->render('welcome.twig.php', $data);

视图文件与FCPATH相关。' themes / site / default'