index.php 981 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. @ob_start();
  3. if(is_file('config.inc.php')){
  4. require 'config.inc.php';
  5. }elseif(is_file('config.sample.inc.php')){
  6. require 'config.sample.inc.php';
  7. }else{
  8. die('Missing Config File.');
  9. }
  10. /**
  11. * 运行环境:development/testing/production
  12. * */
  13. define('ENVIRONMENT','development');
  14. //========================================================
  15. if (defined('ENVIRONMENT'))
  16. {
  17. switch (ENVIRONMENT)
  18. {
  19. case 'development':
  20. error_reporting(E_ALL);
  21. break;
  22. case 'testing':
  23. case 'production':
  24. error_reporting(0);
  25. break;
  26. default:
  27. exit('The application environment is not set correctly.');
  28. }
  29. }
  30. //本地根目录
  31. define('BASE_PATH',dirname(__FILE__).'/');
  32. define('BASE_URL', rtrim(STATIC_URL,'/').'/');
  33. //自动判断环境
  34. if(!defined('RUN_ENV')){
  35. if(defined('SAE_SECRETKEY')){
  36. define('RUN_ENV','SAE');
  37. }elseif(getenv('HTTP_BAE_ENV_SK')){
  38. define('RUN_ENV','BAE');
  39. }else{
  40. define('RUN_ENV','LOCAL');
  41. }
  42. }
  43. require_once BASE_PATH.'include/start.php';