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());
        }
    }
上一篇:Incorrect username or password ( access token )


下一篇:utf8转gbk,libcurl中文乱码处理