如何在树枝中分配变量?

Im migrating my code from smarty to twig

but I dont seem to find how to do this in twig

smarty:

 $smarty->assign('Config',$Core->settings);

how can I do this in Twig ?

You would use 'set'. http://twig.sensiolabs.org/doc/tags/set.html Then you would have to pass in $Core->settings as a variable from your controller like so:

return $this->render('my_template.html.twig', array(
        'core_settings' => $Core->settings,
));

Then in my_template.html.twig you would use set like this:

{% set 'Config' = core_settings %}

I'm not sure if that works for you, Twig is different than smarty (I'm not very familar with smarty) but Twig is powerful.