如何在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');