public static function driver($driver = null, $default = 0) { if ($default) { if (is_null($driver)) { return self::$default_dirver; } else { if (is_object(self::$default_driver)) { return self::$default_driver; } //默认的数据库只设置一次 self::$default_driver = dbfactory::driver($driver); self::$current_driver = self::$default_driver; return self::$default_driver; } } else { return is_null($driver) ? self::$current_driver : (self::$current_driver = dbfactory::driver($driver)); } }
public static function __callstatic($name, $params) { self::$default_driver = dbfactory::driver('pdo'); return call_user_func_array(array(self::$default_driver, $name), $params); }
public static function selectdb($name) { return dbfactory::create($name, self::$cfg[$name]); }