Exemplo n.º 1
0
 /**
  * 创建配置对象,读取配置
  * @param boolean 调试状态
  */
 public static function init($debug = FALSE)
 {
     self::$config = $debugs = new \StdClass();
     // 读取目录下所有文件
     $files = glob(ROOT_PATH . '/app/config/autoload/*');
     if ($debug) {
         $files[] = ROOT_PATH . '/app/config/debug.php';
     } else {
         $files[] = ROOT_PATH . '/app/config/global.php';
     }
     foreach ($files as $file) {
         // 文件读取
         $class = "\\Phalcon\\Config\\Adapter\\" . ucfirst(substr($file, -3));
         // 读取配置信息
         $config = new $class($file);
         // 整合数据
         foreach ($config as $key => $val) {
             self::$config->{$key} = $val;
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Clears all current config parameters.
  */
 public static function clear()
 {
     self::$config = null;
     self::$config = array();
 }