2017-03-03 53 views
0

这是树枝,我在斯利姆注入它在容器中的观点:Slim + Twig - 如何在开发过程中关闭Twig缓存?

// 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; 
}; 

使用此设置,总是枝杈从缓存中读取的模板。有没有什么办法可以在开发期间关闭缓存

回答

3

将“cache”更改为false。 这样的

$twig = new Twig_Environment($loader, array(
    'cache' => false, 
));