最新回答
- 2019-12-51 #
- 2019-12-52 #
通常,引导对象使用以下算法来运行Magento应用程序:
初始化错误处理程序。
创建在任何地方使用并受环境影响的对象管理器和基本共享服务.环境参数正确地注入到这些对象中。
断言未启用维护模式; 否则,终止。
断言安装了Magento应用程序; 否则,终止。 启动Magento应用程序。
欲了解更多信息,请点击此处
通常,引导对象使用以下算法来运行Magento应用程序:
初始化错误处理程序。
创建在任何地方使用并受环境影响的对象管理器和基本共享服务.环境参数正确地注入到这些对象中。
断言未启用维护模式; 否则,终止。
断言安装了Magento应用程序; 否则,终止。 启动Magento应用程序。
欲了解更多信息,请点击此处
虽然这是一个理论问题,但我认为在开发Magento应用程序之前这将是最重要的。
Magento 2中的前身入口点也是index.php。
它包括bootstrap然后从bootstrap对象创建应用程序,最后调用bootstrap的run函数。
Bootstrap
Bootstrap提供运行Magento应用程序的环境。 它检查PHP版本,设置默认错误报告,定义基本路径,初始化和填充自动加载器(从名称空间前缀映射到目录以搜索相应的类)。
Initialization of code
Checks PHP version (if PHP version is less than 5.5.0 then shows an error message and exit execution.)
Sets default error reporting to “E_ALL”
Define the base path of the root directory.
Initialize autoloader
Sets the status of profiler
Sets default time zone to “UTC”
Initialize / Create App
Initialize object manager
Get main configuration array from /app/etc/config.php
Run App
Initialize error handler
Initialize object manager if not initialized till now.
Check maintenance mode is on or not if on then show maintenance page.
Check installation has completed or not if not then redirect it to /setup/index.php
Launch
Get/Set area code
Firstly it gets area code frontend or adminhtml
Then sets area code
加载配置并配置
It loads configuration according to area
获取前端控制器实例并调用路由的调度功能