1
當我嘗試添加添加擴展全球在樹枝如何添加擴展加入全球在樹枝
$view = new \Slim\Views\Twig($settings['template_path'], [
'debug' => $settings['debug'],
'cache' => $settings['cache_path']
]);
// Add extensions
$view->addExtension(new \Slim\Views\TwigExtension(
$c['router'],
$c['request']->getUri()
));
$view->addExtension(new \Core\TwigFunction());
$view->addExtension(new Twig_Extension_Debug());
$view = new Twig_Environment();;
$view->addGlobal('session', $_SESSION);
我收到:
調用未定義的方法Twig_Environment :: offsetSet()
不能正常工作,我的code over variabel $ view ?, –
您能詳細說明哪些方法無效嗎?添加$ view-> addGlobal('session',$ _SESSION)後添加 – meun5
;代碼doesnt'n工作 –