如何在Symfony 2 中获取当前路线?
例如routing.yml:
routing.yml
somePage: pattern: /page/ defaults: { _controller: "AcmeBundle:Test:index" }
我怎样才能得到这个somePage值?
somePage
从 ContainerAware 的东西(如控制器):
$request = $this->container->get('request'); $routeName = $request->get('_route');