本次说明代码

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/ $app = require_once __DIR__.'/../bootstrap/app.php';

主要实现的功能

  1.实例化  Illuminate\Foundation\Application类

  2.初始化基础路径

  3.基本容器(app,Container)和对于类的绑定

  4.基础服务的注册(事件服务EventServiceProvider  日志服务LogServiceProvider  路由服务RoutingServiceProvider)

  5.别名的注册(vendor/laravel/framework/src/Illuminate/Foundation/Application.php文件中的 registerCoreContainerAliases 方法)


流程图


代码

<?php

/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/ /**
* 对于其中的instance register singleton 方法到时候单独拎出来说明
*
* 1.设置基础路径
* 2.使用instance 方法 绑定app 和Illuminate\Foundation\Application类的关系
* 3.使用instance 方法 绑定Container 和Illuminate\Foundation\Application类的关系
* 4.app变量中注册事件服务EventServiceProvider
* 5.app变量中注册日志服务LogServiceProvider
* 6.app变量中注册路由服务RoutingServiceProvider
* 7.别名的注册(vendor/laravel/framework/src/Illuminate/Foundation/Application.php文件中的 registerCoreContainerAliases 方法)
*/
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
); /*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/ /**
* 把App\Http\Kernel::class 类下的参数 映射到lluminate\Contracts\Http\Kernel::class类中
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
); /**
* 把App\Console\Kernel::class 类下的参数 映射到Illuminate\Contracts\Console\Kernel::class类中
*/
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
); /**
* 把App\Exceptions\Handler::class 类下的参数 映射到Illuminate\Contracts\Debug\ExceptionHandler::class类中
*/
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
); /*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/ return $app;

最新文章

  1. Android JNI总结
  2. python RecursionError: maximum recursion depth exceeded in comparison错误
  3. git Could not read from remote repository 解决
  4. Mybatis逆向工程构建项目实例.
  5. jQuery DOM操作
  6. Fiddler使用AutoResponder进行本地文件和线上文件的映射
  7. AC日记——独木桥 洛谷 p1007
  8. 【HDU 5832】A water problem(大数取模)
  9. Talend 从Excel导入Saleforce数据(一) 直接从salesforce lookup 性能的噩梦
  10. javascript中数组揭秘
  11. 【转】linux /centos 中OpenSSL升级方法详解
  12. java中replace和replaceAll的区别
  13. pythn BeautifulSoup
  14. Linux I2C设备驱动编写(一)
  15. win10下安装python2与python3以及pip共存
  16. word文字覆盖问题
  17. Centos 安装 mysql tar.gz
  18. 回文串 --- 动态dp UVA 11584
  19. 使用Numpy实现卷积神经网络(CNN)
  20. hdu 5094 状压bfs+深坑

热门文章

  1. 【转】建立一个更高级别的查询 API:正确使用Django ORM 的方式
  2. poj——1330 Nearest Common Ancestors
  3. 串口调试助手---VB源码
  4. ci 在阿里云访问的时候404
  5. Java中集合List,Map和Set的差别
  6. 2015 Multi-University Training Contest 2 1004 Delicious Apples(DP)
  7. 总是有人想在android上直连mysql,是猴子请来的逗比吗?
  8. libcurl库进行http通讯-一些主要的函数
  9. Android-通过SlidingPaneLayout高仿微信6.2最新版手势滑动返回(一)
  10. Cygwin与minGW