Skip to content

Commit

Permalink
修复数据库连接配置问题
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkeridea committed Aug 22, 2017
1 parent b1280b5 commit 651f214
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions model/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ public function __construct($config=null)
{
$config || $config = Config::$config;
if(!self::$db){
self::$db = new \PDO("mysql:host={$config['DB_HOST']};{$config['DB_PORT']};dbname={$config['DB_NAME']}", $config['DB_USER'], $config['DB_PWD']);
self::$db = new \PDO("mysql:host={$config['DB_HOST']};port={$config['DB_PORT']};dbname={$config['DB_NAME']}", $config['DB_USER'], $config['DB_PWD']);
self::$db->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
self::$db->query("SET NAMES {$config['DB_CHARSET']}");
self::$db->query("use {$config['DB_NAME']}");
}

$this->dbName = Config::$config['DB_NAME'];
$this->dbName = $config['DB_NAME'];
}
}

0 comments on commit 651f214

Please sign in to comment.