index.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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|asp'); //不进入缓存的扩展名,安全起见不要删除PHP
  22. define('NO_LOCATE',false); //设置后将不进行跳转而采用read方式,当想保持文件名一致时启用之。
  23. define('NO_KEY',true); //启用后将不再使用一串md5编码的key作为文件名
  24. define('NO_SECOND_FLODER',true); //启用后将不再使用两层文件夹存储缓存,仅在本地环境、NO_KEY为假时有效
  25. /**
  26. * 空请求时是否显示文档
  27. * */
  28. define('WELCOME_DOC',TRUE);
  29. /**
  30. * 运行环境:development/testing/production
  31. * */
  32. define('ENVIRONMENT','development');
  33. //========================================================
  34. if (defined('ENVIRONMENT'))
  35. {
  36. switch (ENVIRONMENT)
  37. {
  38. case 'development':
  39. error_reporting(E_ALL);
  40. break;
  41. case 'testing':
  42. case 'production':
  43. error_reporting(0);
  44. break;
  45. default:
  46. exit('The application environment is not set correctly.');
  47. }
  48. }
  49. //本地根目录
  50. define('BASE_PATH',dirname(__FILE__).'/');
  51. define('BASE_URL', rtrim(STATIC_URL,'/').'/');
  52. //define('IS_SAE', defined('SAE_SECRETKEY'));
  53. //自定义环境
  54. //define('RUN_ENV', 'BAE'); //可选:BAE/SAE/LOCAL 请大写
  55. if(!defined('RUN_ENV')){
  56. if(defined('SAE_SECRETKEY')){
  57. define('RUN_ENV','SAE');
  58. }elseif(getenv('HTTP_BAE_ENV_SK')){
  59. define('RUN_ENV','BAE');
  60. }else{
  61. define('RUN_ENV','LOCAL');
  62. }
  63. }
  64. require_once BASE_PATH.'include/start.php';