目前我正在使用:
$route=$app->getRequest()->get('_route');
基于我的routing.yml:
done_punctis_brand_stats:
pattern: /brand/{id}/stats/{type}
defaults: {_controller: DonePunctisBundle:Brand:stats, type: 'general'}
requirements:
_method: GET
id: \d+ #digit [0-9]
因此,考虑到这一点,路线将回应: done_punctis_brand_stats
问题是,如果用户在/ brand / 1 / stats / general或/ brand / 1 / stats / othervalue,输出将始终 done_punctis_brand_stats ,我怎么能知道差异(在一个PHP模板)?
答案 0 :(得分:1)
你的PHP模板中的{{ app.request.requesturi }}
是$route=$app->getRequest()->getRequestUri();
。
答案 1 :(得分:1)
尝试:
$app->getRequest()->getRequestUri();