How to get request type (master/sub) in Symfony2 controller?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Is there possible get request type in controller? How? 回答1: To detect if the request is a master or not requires the use of the RequestStack , which should be injected into your controller. The request stack has 3 useful methods getCurrentRequest (); getMasterRequest (); getParentRequest (); The getParentRequest() will always return null if the current request is the master. 回答2: I was looking for this myself, and it seems it is just passed around, so there doesn't seem to be one single place that knows what it is. My thought for