MVC request生命周期

本文详细描述了MVC模式下,从用户发起请求到响应返回的完整流程:用户通过web/index.php发送请求,应用加载配置并创建实例,解析路由,创建控制器,执行过滤器,如果过滤器通过则执行相应动作,动作加载数据模型,渲染视图,并将结果通过响应组件回传给用户浏览器。
摘要由CSDN通过智能技术生成

Request Lifecycle

The following diagram shows how an application handles a request.
这里写图片描述

  1. A user makes a request to the entry script web/index.php.
  2. The entry script loads the application configuration and creates an
    application instance to handle the request.
  3. The application resolves the requested route with the help of the
    request application component.
  4. The application creates a controller instance to handle the request.
  5. The controller creates an action instance and performs the filters
    for the action.
  6. If any filter fails, the action is cancelled.
  7. If all filters pass, the action is executed.
  8. The action loads a data model, possibly from a database.
  9. The action renders a view, providing it with the data model.
  10. The rendered result is returned to the response application
    component.
  11. The response component sends the rendered result to the user’s
    browser.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值