从心开始

2018-07-19  本文已影响0人  之江狂徒

拷贝的别人的,还未验证

thinkphp5.0流程

index.php 

1.define('APP_PATH', __DIR__ . '/../application/'); 定义应用目录

2.require __DIR__ . '/../thinkphp/start.php'; 加载start文件

start.php

1.require __DIR__ . '/base.php';加载base文件

2.App::run()->send();调用base的自动加载方法,加载App.php文件并调用其中的run方法

base.php 

1.定义了很多常量

2.载入loader类(主要是自动加载功能)

3.加载环境变量(不理解)

App.php 

        这个文件做了很多事情

引入以下文件(.php)

use think\Config; --- 配置类(加载各种配置的)

use think\Exception; ---异常类

use think\exception\HttpException; ---http异常相关的信息,比如:http头和状态码

use think\exception\HttpResponseException;

use think\Hook;  ---钩子,不理解

use think\Lang;  ---语言类

use think\Loader; ---不太理解

use think\Log;   --日志类

use think\Request; ---http请求有关的,比如,get,post

use think\Response;  ----输出

use think\Route; ---路由类,不理解

这个App.php加载了上述的文件之后,就通过上述文件的一些功能,做了路由和模块以及配置的进一步操作。

App::run()->send();就是最后一步

App::run()可以得到 一些状态码, send()是调用Response一个方法,然后输出html。

上一篇 下一篇

猜你喜欢

热点阅读