V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
lml12377
V2EX  ›  程序员

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

  •  
  •   lml12377 · 2016-08-24 16:13:57 +08:00 · 2087 次点击
    这是一个创建于 2806 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    求解!

    2 条回复    2016-08-25 10:06:17 +08:00
    ZYWJ
        1
    ZYWJ  
       2016-08-24 16:23:26 +08:00   ❤️ 1
    likezun
        2
    likezun  
       2016-08-25 10:06:17 +08:00   ❤️ 1
    我觉得核心就是:
    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.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2252 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 07:49 · PVG 15:49 · LAX 00:49 · JFK 03:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.