Symfony 中的子请求有什么用途?

2016-08-24 16:13:57 +08:00
 lml12377

看 Symfony 框架,发现 HttpKernel 分了 MASTER_REQUEST 和 SUB_REQUEST ,而且 kernel 做 handle() 时还有个请求栈 requestStack ,一个 url 不是对应一个 Request 请求嘛,为什么还有子请求这个概念?是程序内发出的请求?这个子请求的应用场景是怎样的?主要是为了解决什么问题啊?

求解!

2107 次点击
所在节点    程序员
2 条回复
ZYWJ
2016-08-24 16:23:26 +08:00
likezun
2016-08-25 10:06:17 +08:00
我觉得核心就是:
The only difference internally is that some listeners (e.g. security) may only act upon the master request. Each listener is passed some sub-class of KernelEvent, whose isMasterRequest() can be used to check if the current request is a "master" or "sub" request.

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/301490

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX