本文介绍了如何在PHP框架中实现引导类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,我正在制作自己的MVC框架(请大家不要投票,因为每个人都想制作一个框架.)等等.我想制作一个自举类,就像我在许多框架中看到的那样.我之所以这样做,是因为我决定通过从内部开始学习框架来迈向新的高度.但是,通过它们,我面临的问题很少.但是我将在不同的问题中将它们分开.现在来澄清我的问题:What features should a Bootstrapping class have?Can you give me articles that could help me?

Hey guys I am making my own MVC framework (please do not downvote me because everyone wants to make a framework.) and so.. I want to make a bootstrapping class like I have seen in many frameworks. I am making this because I have decided to move to the next level by started learning a framework from the inside. But I am facing few problems getting through them. But I will separate them in different questions. Now to clarify my question:What features should a Bootstrapping class have? And Can you give me articles that could help me?

推荐答案

不应存在引导程序类".这是一个简单的过程,可以包含在一个简单的脚本中,该脚本将作为您应用程序的入口点. PHP不是Java,因此不需要在类中包含所有内容.

There should not be a "bootstrap class". It is a straightforward process, which can be contain in a simple script, which would serve as entry point for your application. PHP is not Java, therefore you are not require to contain everything within a class.

通常情况下,应用程序的引导阶段将承担以下职责:

Usually bootstrap stage of application would have following responsibilities:

  • 设置自动加载器
  • 初始化路由机制
  • 配置存储抽象(数据库,缓存等)
  • 处理用户请求(使用路由)
  • 发送到MVC

应用程序的引导阶段是应设置对象之间的所有连线的位置.也将是您设置记录器,访问控制和错误处理结构之类的地方.

The bootstrap stage in you application is where all the wiring between objects should be set up. It would also be the place where you set up such things as loggers, access control and error handling structures.

您可以说前端控制器是自举的一部分.

You could say that front controller is a part or bootstrapping.


推荐文章列表:

09-05 10:07
查看更多