/** * 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(); } }
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; } }