base.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: liu21st <liu21st@gmail.com>
  10. // +----------------------------------------------------------------------
  11. namespace think;
  12. // 载入Loader类
  13. require __DIR__ . '/library/think/Loader.php';
  14. // 注册自动加载
  15. Loader::register();
  16. // 注册错误和异常处理机制
  17. Error::register();
  18. // 实现日志接口
  19. if (interface_exists('Psr\Log\LoggerInterface')) {
  20. interface LoggerInterface extends \Psr\Log\LoggerInterface
  21. {}
  22. } else {
  23. interface LoggerInterface
  24. {}
  25. }
  26. // 注册类库别名
  27. Loader::addClassAlias([
  28. 'App' => facade\App::class,
  29. 'Build' => facade\Build::class,
  30. 'Cache' => facade\Cache::class,
  31. 'Config' => facade\Config::class,
  32. 'Cookie' => facade\Cookie::class,
  33. 'Db' => Db::class,
  34. 'Debug' => facade\Debug::class,
  35. 'Env' => facade\Env::class,
  36. 'Facade' => Facade::class,
  37. 'Hook' => facade\Hook::class,
  38. 'Lang' => facade\Lang::class,
  39. 'Log' => facade\Log::class,
  40. 'Request' => facade\Request::class,
  41. 'Response' => facade\Response::class,
  42. 'Route' => facade\Route::class,
  43. 'Session' => facade\Session::class,
  44. 'Url' => facade\Url::class,
  45. 'Validate' => facade\Validate::class,
  46. 'View' => facade\View::class,
  47. ]);