init() public static method

public static init ( )
示例#1
0
文件: Cml.php 项目: linhecheng/cmlphp
 /**
  * 处理配置及语言包相关
  *
  */
 private static function handleConfigLang()
 {
     //引入框架惯例配置文件
     $cmlConfig = Cml::requireFile(CML_CORE_PATH . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'config.php');
     Config::init();
     //应用正式配置文件
     $appConfig = Cml::getApplicationDir('global_config_path') . DIRECTORY_SEPARATOR . Config::$isLocal . DIRECTORY_SEPARATOR . 'normal.php';
     is_file($appConfig) ? $appConfig = Cml::requireFile($appConfig) : exit('Config File [' . Config::$isLocal . '/normal.php] Not Found Please Check!');
     is_array($appConfig) || ($appConfig = []);
     $commonConfig = Cml::getApplicationDir('global_config_path') . DIRECTORY_SEPARATOR . 'common.php';
     $commonConfig = is_file($commonConfig) ? Cml::requireFile($commonConfig) : [];
     Config::set(array_merge($cmlConfig, $commonConfig, $appConfig));
     //合并配置
     if (Config::get('debug')) {
         self::$debug = true;
         $GLOBALS['debug'] = true;
         //开启debug
         Debug::addTipInfo(CML_CORE_PATH . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'config.php', Debug::TIP_INFO_TYPE_INCLUDE_FILE);
         Debug::addTipInfo(Cml::getApplicationDir('global_config_path') . DIRECTORY_SEPARATOR . Config::$isLocal . DIRECTORY_SEPARATOR . 'normal.php', Debug::TIP_INFO_TYPE_INCLUDE_FILE);
         empty($commonConfig) || Debug::addTipInfo(Cml::getApplicationDir('global_config_path') . DIRECTORY_SEPARATOR . 'common.php', Debug::TIP_INFO_TYPE_INCLUDE_FILE);
     }
     //引入系统语言包
     Lang::set(Cml::requireFile(CML_CORE_PATH . DIRECTORY_SEPARATOR . 'Lang' . DIRECTORY_SEPARATOR . Config::get('lang') . '.php'));
 }
示例#2
0
文件: Cml.php 项目: dlpc/cmlphp
 /**
  * 处理配置及语言包相关
  *
  */
 private static function handleConfigLang()
 {
     //因自动加载机制需要\Cml\Config和\Cml\Lang的支持所以手动载入这两个类
     require CML_PATH . DIRECTORY_SEPARATOR . 'Cml' . DIRECTORY_SEPARATOR . 'Http' . DIRECTORY_SEPARATOR . 'Request.php';
     require CML_PATH . DIRECTORY_SEPARATOR . 'Cml' . DIRECTORY_SEPARATOR . 'Config.php';
     require CML_PATH . DIRECTORY_SEPARATOR . 'Cml' . DIRECTORY_SEPARATOR . 'Lang.php';
     //引入框架惯例配置文件
     $cmlConfig = (require CML_PATH . DIRECTORY_SEPARATOR . 'Cml' . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'config.php');
     Config::init();
     //应用正式配置文件
     $appConfig = CML_APP_FULL_PATH . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . Config::$isLocal . DIRECTORY_SEPARATOR . 'normal.php';
     is_file($appConfig) ? $appConfig = (require $appConfig) : exit('Config File [' . Config::$isLocal . '/normal.php] Not Found Please Check!');
     is_array($appConfig) || ($appConfig = array());
     $commonConfig = CML_APP_FULL_PATH . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'common.php';
     $commonConfig = is_file($commonConfig) ? require $commonConfig : array();
     Config::set(array_merge($cmlConfig, $commonConfig, $appConfig));
     //合并配置
     define('CML_IS_MULTI_MODULES', Config::get('is_multi_modules'));
     define('CML_APP_MODULES_PATH', CML_APP_FULL_PATH . (CML_IS_MULTI_MODULES ? DIRECTORY_SEPARATOR . \Cml\Config::get('application_dir') : ''));
     //引入系统语言包
     Lang::set(require CML_PATH . DIRECTORY_SEPARATOR . 'Cml' . DIRECTORY_SEPARATOR . 'Lang' . DIRECTORY_SEPARATOR . Config::get('lang') . '.php');
 }