protected static function GetDb($config) { $options = array(PDO::ATTR_PERSISTENT => true, PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING, PDO::MYSQL_ATTR_INIT_COMMAND => 'set names utf8', PDO::ATTR_CASE => PDO::CASE_LOWER); $host = $config['host']; $dbname = $config['dbname']; $username = $config['username']; $password = $config['password']; try { $db = new PDO("mysql:host={$host};dbname={$dbname}", "{$username}", "{$password}", $options); self::$db = $db; } catch (PDOException $e) { exit($e->getMessage()); } }
protected function GetDB() { $this->db = Jiaoyun_Database::GetIns(); $this->tb = $this->SetTb(); }