what is the difference between MASTER / SUB REQUEST in Symfony2?

前端 未结 2 1897
灰色年华
灰色年华 2020-12-18 19:20

so im reading the internals documentation for symfony2 http://symfony.com/doc/current/book/internals.html and i dont understand this section http://symfony.com/doc/current/b

相关标签:
2条回答
  • 2020-12-18 20:06

    The master request is the one that comes from the original user; the subrequest is the one that you do internally — either with the forward() method of HttpKernel — or by the forward() helper of the framework's Controller class — or {% render ... %} in Twig.

    0 讨论(0)
  • 2020-12-18 20:10

    The master request is the one, that is triggered by the browser and the sub requests are requests from within the application. For example a template can render another action

    <div id="sidebar">
        {% render "AcmeArticleBundle:Article:recentArticles" with {'max': 3} %}
    </div>
    

    (Example taken from the manual)

    This will lead to a sub request.

    0 讨论(0)
提交回复
热议问题