入口文件 public/index.php

1、加载composer的自动加载器

require __DIR__.'/../vendor/autoload.php';

自动加载,不用再各种require了,更重要的是可以使用composer管理包,管理依赖,可以参考下composer的使用。

2、bootstrap/app.php 得到laravel应用程序实例

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

bootstrap/app.php文件很简单,实例化并注册一些服务

//创建app实例,一切都是由此容器而起,包括服务提供者等等
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
); //注册HTTP内核,web端的请求处理,查看下app\http\Kernal父类
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
); //注册控制台内核,cli的请求处理
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
); //错误处理
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
); return $app;

3、HTTP/控制器内核

//上面注册过此服务,这里调用
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); //服务提供者的handle方法
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
); $response->send(); $kernel->terminate($request, $response);

最新文章

  1. C#计算代码行数
  2. 二叉搜索树(Binary Search Tree)
  3. ubuntu1404_server搭建lamp
  4. 1471. Tree(LCA)
  5. 使用Spring-data-redis操作Redis的Sentinel
  6. linux下ssh免密登陆
  7. powerdesigner for sqlserver的一些实用配置
  8. 在VC6.0中能不能使用Duilib界面库呢?
  9. 使用 Visual Studio 对exe文件进行数字签名
  10. iOS 调用私有函数安装app 卸载 app
  11. 记录一次raid数据恢复及回迁成功的案例
  12. 记一次小型生产事故 | BeyondComper跨编码方式复制文件内容
  13. 使用FileUpload实现Servlet的文件上传
  14. docker(七) 使用dockerfile-maven-plugin插件构建docker镜像
  15. CentOS 6.5 64位下安装Redis3.0.2的具体流程
  16. Android 第二波
  17. 『TensorFlow』读书笔记_进阶卷积神经网络_分类cifar10_上
  18. 合并多个Excel文件
  19. java线程池和中断总结
  20. [No000017E]改善C#程序的建议7:正确停止线程

热门文章

  1. SAP标准培训课程C4C10学习笔记(四)第四单元
  2. Fiddler-1 官网下载及安装
  3. IOS 添加定时器(NSTimer)
  4. Jenkins使用分组过滤分类
  5. 神奇的暴力数据结构——ODT
  6. log4net为什么会打印两次?
  7. failed to bind pixmap to texture
  8. mysql题目(二学年)
  9. Juery返回Json数据格式,webForm中使用
  10. Python的静态方法和类方法