index.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. @ob_start();
  3. /**
  4. * 设置源静态文件的根目录的URL地址
  5. * */
  6. define('STATIC_URL','http://www.baidu.com/');
  7. define('STATIC_HOST',''); //特殊应用下可以填写源站域名,会作为http头的hosts传递,正常情况请留空。
  8. //define('RUN_ENV', 'BAE'); //自定义环境(如不去掉前面的//则自动判断)可选:BAE/SAE/LOCAL 请大写
  9. /**
  10. * SAE storage的domain,BAE的bucket,本地的存储路径(相对于index.php的相对目录,前无斜杠后有斜杠)
  11. * */
  12. define('DOMAIN','cdn'); //SAE or BAE
  13. //define('DOMAIN','data/cache/'); //本地
  14. define('PURGE_KEY','purge'); //访问http://domain/PURGE_KEY/path/to/file来刷新缓存
  15. define('ALLOW_REGX','.*'); //设置防盗链允许的[域名]正则表达式
  16. //define('ALLOW_DOMAIN','^(best33\.com|.*\.best33\.com|)$'); //允许best33.com,*.best33.com,浏览器直接访问
  17. //define('ALLOW_DOMAIN','^(best33\.com|.*\.best33\.com)$'); //允许best33.com,*.best33.com,不允许浏览器直接访问
  18. //define('ALLOW_DOMAIN','^(.*)$'); //允许任意,允许浏览器访问
  19. //define('ALLOW_DOMAIN','^(.+)$'); //允许任意,但不允许浏览器访问
  20. define('MIME','text/html'); //默认MIME类型,可以设为application/octet-stream则对未知项目自动弹出下载
  21. define('DIRECT_EXT','php|html'); //不进入缓存的扩展名
  22. /**
  23. * 空请求时是否显示文档
  24. * */
  25. define('WELCOME_DOC',TRUE);
  26. /**
  27. * 运行环境:development/testing/production
  28. * */
  29. define('ENVIRONMENT','development');
  30. //========================================================
  31. if (defined('ENVIRONMENT'))
  32. {
  33. switch (ENVIRONMENT)
  34. {
  35. case 'development':
  36. error_reporting(E_ALL);
  37. break;
  38. case 'testing':
  39. case 'production':
  40. error_reporting(0);
  41. break;
  42. default:
  43. exit('The application environment is not set correctly.');
  44. }
  45. }
  46. //本地根目录
  47. define('BASE_PATH',dirname(__FILE__).'/');
  48. define('BASE_URL', rtrim(STATIC_URL,'/').'/');
  49. //define('IS_SAE', defined('SAE_SECRETKEY'));
  50. //自定义环境
  51. //define('RUN_ENV', 'BAE'); //可选:BAE/SAE/LOCAL 请大写
  52. if(!defined('RUN_ENV')){
  53. if(defined('SAE_SECRETKEY')){
  54. define('RUN_ENV','SAE');
  55. }elseif(getenv('HTTP_BAE_ENV_SK')){
  56. define('RUN_ENV','BAE');
  57. }else{
  58. define('RUN_ENV','LOCAL');
  59. }
  60. }
  61. require_once BASE_PATH.'include/start.php';