autoload.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: zhengmingwei
  5. * Date: 2020/4/29
  6. * Time: 10:43 PM
  7. */
  8. define('THINK_VERSION', '5.0.24');
  9. define('THINK_START_TIME', microtime(true));
  10. define('THINK_START_MEM', memory_get_usage());
  11. define('EXT', '.php');
  12. define('DS', DIRECTORY_SEPARATOR);
  13. defined('THINK_PATH') or define('THINK_PATH', __DIR__ . DS . '..' . DS . 'thinkphp' . DS);
  14. define('LIB_PATH', THINK_PATH . 'library' . DS);
  15. define('CORE_PATH', LIB_PATH . 'think' . DS);
  16. define('TRAIT_PATH', LIB_PATH . 'traits' . DS);
  17. defined('APP_PATH') or define('APP_PATH', THINK_PATH . '..' . DS . 'application' . DS);
  18. defined('ROOT_PATH') or define('ROOT_PATH', dirname(realpath(APP_PATH)) . DS);
  19. defined('EXTEND_PATH') or define('EXTEND_PATH', ROOT_PATH . 'extend' . DS);
  20. defined('VENDOR_PATH') or define('VENDOR_PATH', ROOT_PATH . 'vendor' . DS);
  21. defined('RUNTIME_PATH') or define('RUNTIME_PATH', ROOT_PATH . 'runtime' . DS);
  22. defined('LOG_PATH') or define('LOG_PATH', RUNTIME_PATH . 'log' . DS);
  23. defined('CACHE_PATH') or define('CACHE_PATH', RUNTIME_PATH . 'cache' . DS);
  24. defined('TEMP_PATH') or define('TEMP_PATH', RUNTIME_PATH . 'temp' . DS);
  25. defined('CONF_PATH') or define('CONF_PATH', APP_PATH); // 配置文件目录
  26. //var_dump(CONF_PATH);exit;
  27. defined('CONF_EXT') or define('CONF_EXT', EXT); // 配置文件后缀
  28. defined('ENV_PREFIX') or define('ENV_PREFIX', 'PHP_'); // 环境变量的配置前缀
  29. // 环境常量
  30. define('IS_CLI', PHP_SAPI == 'cli' ? true : false);
  31. define('IS_WIN', strpos(PHP_OS, 'WIN') !== false);
  32. // 载入Loader类
  33. require CORE_PATH . 'Loader.php';
  34. // 注册自动加载
  35. \think\Loader::register();
  36. // 初始化,加载函数等
  37. \think\App::initCommon();
  38. //参考:https://blog.csdn.net/maquealone/article/details/88227685 112