app.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Create The Application
  5. |--------------------------------------------------------------------------
  6. |
  7. | The first thing we will do is create a new Laravel application instance
  8. | which serves as the "glue" for all the components of Laravel, and is
  9. | the IoC container for the system binding all of the various parts.
  10. |
  11. */
  12. // mini全局
  13. require __DIR__.'/../app/Global/Vars.php';
  14. require __DIR__.'/../app/Global/System.php';
  15. $app = new Illuminate\Foundation\Application(
  16. $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
  17. );
  18. /*
  19. |--------------------------------------------------------------------------
  20. | Bind Important Interfaces
  21. |--------------------------------------------------------------------------
  22. |
  23. | Next, we need to bind some important interfaces into the container so
  24. | we will be able to resolve them when needed. The kernels serve the
  25. | incoming requests to this application from both the web and CLI.
  26. |
  27. */
  28. $app->singleton(
  29. Illuminate\Contracts\Http\Kernel::class,
  30. App\Http\Kernel::class
  31. );
  32. $app->singleton(
  33. Illuminate\Contracts\Console\Kernel::class,
  34. App\Console\Kernel::class
  35. );
  36. $app->singleton(
  37. Illuminate\Contracts\Debug\ExceptionHandler::class,
  38. App\Exceptions\Handler::class
  39. );
  40. /*
  41. |--------------------------------------------------------------------------
  42. | Return The Application
  43. |--------------------------------------------------------------------------
  44. |
  45. | This script returns the application instance. The instance is given to
  46. | the calling script so we can separate the building of the instances
  47. | from the actual running of the application and sending responses.
  48. |
  49. */
  50. return $app;