0
我通过Twigcode将数据从CMS呈现给控制器,并且Controller呈现树枝模板。我想拥有目前的路线。我已经尝试过使用:获取当前路径/路径传递_internal路线
// Controller
$request = $this->container->get('request');
$routeName = $request->get('_route');
// or Twigtemplate
{{ app.request.attributes.get('_route') }}
但结果是“_internal”。我该如何解决这个问题?
即时通讯异常:渲染模板期间抛出异常(“_internal”路径有一些缺少必需参数(“控制器”,“路径”,“_format”)。“) – raphidue
看到这个评论:http://stackoverflow.com/questions/7096546/how-to-get-current-route-in-symfony-2#comment14132455_7777229。我猜你的模板是以独立模式渲染的。 –
对不起,我不使用独立模式:( – raphidue