Core.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006-2012 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. // ThinkPHP 入口文件
  12. //记录开始运行时间
  13. $GLOBALS['_beginTime'] = microtime(TRUE);
  14. // 记录内存初始使用
  15. define('MEMORY_LIMIT_ON',function_exists('memory_get_usage'));
  16. if(MEMORY_LIMIT_ON) $GLOBALS['_startUseMems'] = memory_get_usage();
  17. // 系统目录定义
  18. defined('THINK_PATH') or define('THINK_PATH', dirname(__FILE__).'/');
  19. defined('APP_PATH') or define('APP_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/');
  20. defined('RUNTIME_PATH') or define('RUNTIME_PATH','./Cache/');
  21. defined('APP_DEBUG') or define('APP_DEBUG',false); // 是否调试模式
  22. if(defined('ENGINE_NAME')) {
  23. defined('ENGINE_PATH') or define('ENGINE_PATH',THINK_PATH.'Extend/Engine/');
  24. require ENGINE_PATH.strtolower(ENGINE_NAME).'.php';
  25. }else{
  26. defined('RUNTIME_PATH') or define('RUNTIME_PATH',APP_PATH.'Runtime/');
  27. $runtime = defined('MODE_NAME')?'~'.strtolower(MODE_NAME).'_runtime.php':'~runtime.php';
  28. defined('RUNTIME_FILE') or define('RUNTIME_FILE',RUNTIME_PATH.$runtime);
  29. if(!APP_DEBUG && is_file(RUNTIME_FILE)) {
  30. // 部署模式直接载入运行缓存
  31. require RUNTIME_FILE;
  32. }else{
  33. // 加载运行时文件
  34. require THINK_PATH.'Common/runtime.php';
  35. }
  36. }