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());
}
}