index.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. #phpinfo();
  3. #die();
  4. defined('YII_DEBUG') or define('YII_DEBUG', true);
  5. ini_set('display_errors','On');
  6. error_reporting(E_ALL ^ E_NOTICE);
  7. ini_set('pcre.backtrack_limit', 999999999);
  8. session_start();
  9. defined('IN_ADMIN') or define('IN_ADMIN',true);
  10. setlocale(LC_ALL, 'zh_CN.UTF-8');
  11. defined('TIMESTAMP') or define('TIMESTAMP',time());//start time of request
  12. defined('SYS_START_TIME') or define('SYS_START_TIME',microtime());//start time of request
  13. define('IN_KIIVO', true);//make the file be the only import of the app
  14. //KIIVOKMS框架目录,如:D:\phpStudy\PHPTutorial\WWW\kiivokms\
  15. defined('BASE_PATH') or define('BASE_PATH', dirname(dirname(__FILE__).DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR);
  16. //应用目录,如:D:\phpStudy\PHPTutorial\WWW\kiivokms\web\
  17. defined('APP_PATH') or define('APP_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
  18. $config = require __DIR__ . '/../config/config.php';
  19. include_once __DIR__ . '/../common/functions/global.php';
  20. include_once __DIR__ . '/../common/functions/dir.php';
  21. include_once __DIR__ . '/../common/functions/cus.php';
  22. defined('MYIP') or define('MYIP',ip());
  23. $domain = require_config('domain.php');
  24. define('COOKIE_DOMAIN', $domain['cookie_domain']);//定义cookie全局域
  25. define('WAP_URL', $domain['wap_url']);//WAP站域名
  26. define('WEB_URL', $domain['web_url']);//PC站域名
  27. define('API_URL', $domain['api_url']);//接口域名
  28. define('UPLOAD_DOMAIN', $domain['upload_domain']);//附件域名
  29. require __DIR__ . '/../vendor/autoload.php';
  30. require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';
  31. //主机协议
  32. define('SITE_PROTOCOL', isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://');
  33. //当前访问的主机名(格式:www.xxx.cn)
  34. define('SITE_URL', (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''));
  35. /*****************判断是否手机端***********************/
  36. if(strpos(WAP_URL,SITE_PROTOCOL.SITE_URL)!==false||check_mobile())
  37. {
  38. defined('IN_WAP') or define('IN_WAP',TRUE);
  39. if(check_baiduapp())
  40. {
  41. defined('REQUEST_FROM') or define('REQUEST_FROM',3);
  42. }
  43. else if(check_wxapp()){
  44. defined('REQUEST_FROM') or define('REQUEST_FROM',4);
  45. }
  46. else if(check_micromsg())
  47. {
  48. defined('REQUEST_FROM') or define('REQUEST_FROM',5);
  49. }
  50. else
  51. {
  52. defined('REQUEST_FROM') or define('REQUEST_FROM',2);
  53. }
  54. defined('APP_URL') or define('APP_URL',WAP_URL);
  55. }
  56. else
  57. {
  58. defined('IN_WAP') or define('IN_WAP',FALSE);
  59. defined('REQUEST_FROM') or define('REQUEST_FROM',1);
  60. defined('APP_URL') or define('APP_URL',WEB_URL);
  61. }
  62. defined("DEVICE_TYPE") or define("DEVICE_TYPE",get_device_type());
  63. $config = array_merge_recursive(require_config('web.php'), $config);
  64. $params = $config['params'];
  65. /********************二次定义params结束*****************************************/
  66. defined('UPLOAD_PATH') or define('UPLOAD_PATH',$config['params']['uploadPath']);
  67. defined('THUMB_PATH') or define('THUMB_PATH',$config['params']['thumbPath']);
  68. defined('UPLOAD_URL') or define('UPLOAD_URL',$config['params']['uploadUrl']);
  69. defined('HTML_PATH') or define('HTML_PATH',$config['params']['htmlPath']);
  70. defined('CACHE_PATH') or define('CACHE_PATH',$config['params']['cachePath']);
  71. //定义网页编码
  72. defined('CHARSET') or define('CHARSET',$config['params']['charSet']);
  73. //定义时区
  74. defined('TIME_ZONE') or define('TIME_ZONE',$config['params']['timeZone']);
  75. //加密因子
  76. defined('AUTH_KEY') or define('AUTH_KEY',$config['params']['authKey']);
  77. header("Content-type: text/html; charset=".CHARSET);
  78. (new yii\web\Application($config))->run();