AppInit.php 870 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 https://www.sapixx.com All rights reserved.
  4. * @license Licensed (http://www.apache.org/licenses/LICENSE-2.0).
  5. * @author pillar<ltmn@qq.com>
  6. * 初始化应用,并设置常用常量
  7. */
  8. namespace app\common\behavior;
  9. use think\facade\Env;
  10. class AppInit{
  11. /**
  12. * 初始化行为入口
  13. */
  14. public function run(){
  15. $this->initPathConst();
  16. }
  17. /**
  18. * 初始化路径常量
  19. */
  20. private function initPathConst(){
  21. define('DS',DIRECTORY_SEPARATOR);
  22. define('PATH_TOOT',Env::get('root_path'));
  23. define('PATH_APP',Env::get('app_path'));
  24. define('PATH_PUBLIC', PATH_TOOT.'public'.DS);
  25. define('PATH_THEMES', PATH_TOOT.'themes'.DS);
  26. define('PATH_RES', PATH_PUBLIC.'res'.DS);
  27. define('PATH_STATIC', PATH_PUBLIC.'static'.DS);
  28. }
  29. }