2017-03-03 27 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, 
));