编程语言
首页 > 编程语言> > laravel源码解析之bootstrap过程

laravel源码解析之bootstrap过程

作者:互联网

1.简介

laravel有两个主要的引导流程

第一个是在创建Application对象时的引导

$app = require_once __DIR__.'/../bootstrap/app.php';

主要是创建了Application容器对象,并且注册了核心的几个对象

第二个是在处理请求之前Illuminate\Foundation\Http\Kernel中使用引导器进行的引导

    protected $bootstrappers = [
        \Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables::class,
        \Illuminate\Foundation\Bootstrap\LoadConfiguration::class,
        \Illuminate\Foundation\Bootstrap\HandleExceptions::class,
        \Illuminate\Foundation\Bootstrap\RegisterFacades::class,
        \Illuminate\Foundation\Bootstrap\RegisterProviders::class,
        \Illuminate\Foundation\Bootstrap\BootProviders::class,
    ];

    public function bootstrap()
    {
        if (! $this->app->hasBeenBootstrapped()) {
            $this->app->bootstrapWith($this->bootstrappers());
        }
    }

标签:laravel,Foundation,bootstrap,Illuminate,app,Bootstrap,源码,class
来源: https://blog.csdn.net/qq_27868061/article/details/121444128