Beispiel #1
0
 /**
  * 初始化配置
  * 根据当前的环境 去初始化出系统所需要的配置
  */
 private static function _InitConfig($configFile, $env)
 {
     if (file_exists($configFile)) {
         //specify env config
         require $configFile;
         if ($env === 'product') {
             $develop = null;
             unset($develop);
         } else {
             $product = null;
             unset($product);
         }
         self::$Config = ${$env};
         //check config validation.
         //create error_file
         if (isset(self::$Config->app->error_log) && !file_exists(self::$Config->app->error_log)) {
             $fp = fopen(self::$Config->app->error_log, "w+");
             //打开文件指针,创建文件
             if (!is_writable(self::$Config->app->error_log)) {
                 throw new Exception('sorry the file' . self::$Config->app->error_log . ' is not writable');
             }
             fclose($fp);
             //关闭指针
         }
     } else {
         throw new Exception("WF didn't find {$configFile} config file");
     }
 }