Slim + Twig - 如何在开发过程中关闭 Twig 缓存?
这是我在 Slim 的容器中注入的树枝视图:
This is the view which is twig that I inject it in the container in Slim:
// Views and Templates
// https://www.slimframework.com/docs/features/templates.html
$container['view'] = function ($container) {
$settings = $container->get('settings');
$loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader, array(
'cache' => 'cache',
));
// Add twig extension.
$twig->addExtension(new Twig_Extensions_Extension_Array());
return $twig;
};
使用此设置,Twig 总是从缓存中读取模板.在开发过程中有什么办法可以关闭缓存?
With this setting, Twig always read the template from the cache. Is there any way I can turn off the cache during the development?
推荐答案
将缓存"更改为 false.像这样
change "cache" to false. Like this
$twig = new Twig_Environment($loader, array(
'cache' => false,
));
相关文章