yii 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/bin/env php
  2. <?php
  3. /**
  4. * Yii console bootstrap file.
  5. *
  6. * @link http://www.yiiframework.com/
  7. * @copyright Copyright (c) 2008 Yii Software LLC
  8. * @license http://www.yiiframework.com/license/
  9. */
  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(__FILE__).DIRECTORY_SEPARATOR);
  16. $config = require __DIR__ . '/config/config.php';
  17. require __DIR__ . '/vendor/autoload.php';
  18. require __DIR__ . '/vendor/yiisoft/yii2/Yii.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. $domain = require_config('domain.php');
  23. define('COOKIE_DOMAIN', $domain['cookie_domain']);//定义cookie全局域
  24. define('WAP_URL', $domain['wap_url']);//WAP站域名
  25. define('WEB_URL', $domain['web_url']);//PC站域名
  26. define('API_URL', $domain['api_url']);//接口域名
  27. define('UPLOAD_DOMAIN', $domain['upload_domain']);//附件域名
  28. $config = array_merge_recursive(require_config('console.php'), $config);//命令行配置
  29. $params = $config['params'];
  30. //定义网页编码
  31. defined('CHARSET') or define('CHARSET',$config['params']['charSet']);
  32. //加密因子
  33. defined('AUTH_KEY') or define('AUTH_KEY',$config['params']['authKey']);
  34. //主机协议
  35. define('SITE_PROTOCOL', strpos(WEB_URL,'https') !==false ? 'https://' : 'http://');
  36. //当前访问的主机名(格式:www.xxx.cn)
  37. define('SITE_URL', (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''));
  38. //定义时区
  39. defined('TIME_ZONE') or define('TIME_ZONE',$config['params']['timeZone']);
  40. /********************二次定义params结束*****************************************/
  41. defined('UPLOAD_PATH') or define('UPLOAD_PATH',$config['params']['uploadPath']);
  42. defined('THUMB_PATH') or define('THUMB_PATH',$config['params']['thumbPath']);
  43. defined('UPLOAD_URL') or define('UPLOAD_URL',$config['params']['uploadUrl']);
  44. defined('HTML_PATH') or define('HTML_PATH',$config['params']['htmlPath']);
  45. defined('CACHE_PATH') or define('CACHE_PATH',$config['params']['cachePath']);
  46. defined('IN_WAP') or define('IN_WAP',FALSE);
  47. $application = new yii\console\Application($config);
  48. $exitCode = $application->run();
  49. exit($exitCode);