Cml\Config::init PHP Method

init() public static method

public static init ( )
    public static function init()
    {
        self::$isLocal = Cml::getContainer()->make('cml_environment')->getEnv();
    }

Usage Example

Exemplo n.º 1
0
 /**
  * 处理配置及语言包相关
  *
  */
 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'));
 }
All Usage Examples Of Cml\Config::init