index.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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', 'GCS'); //自定义环境(如不去掉前面的//则自动判断)可选:BAE/SAE/LOCAL 请大写
  9. /**
  10. * SAE storage的domain,BAE的bucket,本地的存储路径(相对于index.php的相对目录,前无斜杠后有斜杠)
  11. * */
  12. define('DOMAIN','llllllayer'); //SAE or BAE
  13. //define('DOMAIN','data/cache/'); //本地
  14. //define('CS_AK','dummy'); //自定义AK/SK,通常不需要
  15. //define('CS_SK','dummy');
  16. define('PURGE_KEY','purge'); //访问http://domain/PURGE_KEY/path/to/file来刷新缓存
  17. define('ALLOW_REGX','.*'); //设置防盗链允许的[域名]正则表达式
  18. //define('ALLOW_DOMAIN','^(best33\.com|.*\.best33\.com|)$'); //允许best33.com,*.best33.com,浏览器直接访问
  19. //define('ALLOW_DOMAIN','^(best33\.com|.*\.best33\.com)$'); //允许best33.com,*.best33.com,不允许浏览器直接访问
  20. //define('ALLOW_DOMAIN','^(.*)$'); //允许任意,允许浏览器访问
  21. //define('ALLOW_DOMAIN','^(.+)$'); //允许任意,但不允许浏览器访问
  22. define('MIME','text/html'); //默认MIME类型,可以设为application/octet-stream则对未知项目自动弹出下载
  23. define('DIRECT_EXT','php|asp'); //不进入缓存的扩展名,安全起见不要删除PHP
  24. define('NO_LOCATE',false); //设置后将不进行跳转而采用read方式,当想保持文件名一致时启用之。
  25. define('NO_KEY',true); //启用后将不再使用一串md5编码的key作为文件名
  26. define('NO_SECOND_FLODER',true); //启用后将不再使用两层文件夹存储缓存,仅在本地环境、NO_KEY为假时有效
  27. /**
  28. * 空请求时是否显示文档
  29. * */
  30. define('WELCOME_DOC',TRUE);
  31. /**
  32. * 运行环境:development/testing/production
  33. * */
  34. define('ENVIRONMENT','development');
  35. //========================================================
  36. if (defined('ENVIRONMENT'))
  37. {
  38. switch (ENVIRONMENT)
  39. {
  40. case 'development':
  41. error_reporting(E_ALL);
  42. break;
  43. case 'testing':
  44. case 'production':
  45. error_reporting(0);
  46. break;
  47. default:
  48. exit('The application environment is not set correctly.');
  49. }
  50. }
  51. //本地根目录
  52. define('BASE_PATH',dirname(__FILE__).'/');
  53. define('BASE_URL', rtrim(STATIC_URL,'/').'/');
  54. //define('IS_SAE', defined('SAE_SECRETKEY'));
  55. //自定义环境
  56. if(!defined('RUN_ENV')){
  57. if(defined('SAE_SECRETKEY')){
  58. define('RUN_ENV','SAE');
  59. }elseif(getenv('HTTP_BAE_ENV_SK')){
  60. define('RUN_ENV','BAE');
  61. }else{
  62. define('RUN_ENV','LOCAL');
  63. }
  64. }
  65. require_once BASE_PATH.'include/start.php';