getConfig() 공개 정적인 메소드

支持新的conf配置格式(类似nginx的配置)
public static getConfig ( string $configFile, $zone = null ) : mixed
$configFile string
리턴 mixed $result
예제 #1
0
파일: SDb.php 프로젝트: hetao29/slightphp
 /**
  * @param string $zone
  * @param string $type	main|query
  * @return array
  */
 static function getConfig($zone = null, $type = "main")
 {
     $config = SConfig::getConfig(self::$_config_file, $zone);
     if (isset($config->{$type})) {
         return $config->{$type};
     } elseif (isset($config->main)) {
         return $config->main;
     }
     return;
 }
예제 #2
0
 /**
  * @param string $zone
  * @return array
  */
 static function getConfig($zone = null, $type = "host")
 {
     $config = SConfig::getConfig(self::$_config, $zone);
     if (isset($config->{$type})) {
         return $config->{$type};
     } elseif (isset($config->host)) {
         return $config->host;
     }
     return;
 }
예제 #3
0
 static function getConfig($zone = null)
 {
     return SConfig::getConfig(self::$_config, $zone);
 }
예제 #4
0
 /**
  * @return log
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         $startTime = microtime(true) * 1000;
         $logConf = !empty($GLOBALS['LOG_CONF']) ? $GLOBALS['LOG_CONF'] : 'default';
         $logConfig = SConfig::getConfig(ROOT_CONFIG . "/log.conf", $logConf);
         if (!empty($logConfig->filename)) {
             $logConfig->filename = sprintf($logConfig->filename, date('Ymd'));
             self::$instance = new SLog($logConfig, $startTime);
         } else {
             $stdClass = new stdClass();
             $stdClass->appName = 'AllLog';
             $stdClass->type = 'LOCAL_LOG';
             $stdClass->level = '0x15';
             $stdClass->path = '/tmp';
             $stdClass->filename = 'All_log.' . date('Ymd');
             self::$instance = new SLog($stdClass, $startTime);
         }
     }
     return self::$instance;
 }