Пример #1
0
Файл: DB.php Проект: kijtra/db
 /**
  * Config getter
  *
  * @param string  $key  Config array key
  * @return mixed  If pass $key return one, else all config data
  */
 public function getConfig($key = null)
 {
     if (isset($key)) {
         if ($this->config->offsetExists($key)) {
             return $this->config->offsetGet($key);
         }
     } else {
         return $this->config->all();
     }
 }
Пример #2
0
 public function __construct()
 {
     if ($this->dbConn) {
         echo "hufeng\n";
         return $this->dbConn;
     } else {
         $confObj = new Config(BASEDIR . '/App/Common/Conf');
         $conf = $confObj->offsetGet('config');
         $config = $conf['DB_MASTER'];
         $this->dbConn = new \Simplon\Mysql\Mysql($config['server'], $config['username'], $config['password'], $config['database']);
         return $this->dbConn;
     }
 }