From 00cd2e61d9c2ce749af512405418c3b13d5a72f7 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 27 Apr 2016 15:44:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Error.php | 2 ++ library/think/Model.php | 2 +- library/think/db/Connection.php | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/library/think/Error.php b/library/think/Error.php index 7a5fb4db..9fdd240a 100644 --- a/library/think/Error.php +++ b/library/think/Error.php @@ -11,7 +11,9 @@ namespace think; +use think\Config; use think\exception\ErrorException; +use think\Log; class Error { diff --git a/library/think/Model.php b/library/think/Model.php index 53ad11f6..d387296e 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -23,7 +23,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess // 数据库对象池 private static $links = []; // 数据库配置 - protected static $connection; + protected static $connection = []; // 数据表名称 protected static $table; // 回调事件 diff --git a/library/think/db/Connection.php b/library/think/db/Connection.php index a2887745..aa4ce76d 100644 --- a/library/think/db/Connection.php +++ b/library/think/db/Connection.php @@ -98,7 +98,7 @@ abstract class Connection * @access public * @param array $config 数据库配置数组 */ - public function __construct($config = '') + public function __construct(array $config = []) { if (!empty($config)) { $this->config = array_merge($this->config, $config); @@ -170,12 +170,12 @@ abstract class Connection /** * 连接数据库方法 * @access public - * @param mixed $config 连接参数 + * @param array $config 连接参数 * @param integer $linkNum 连接序号 * @param false|array $autoConnection 是否自动连接主数据库(用于分布式) * @return \PDO */ - public function connect($config = '', $linkNum = 0, $autoConnection = false) + public function connect(array $config = [], $linkNum = 0, $autoConnection = false) { if (!isset($this->links[$linkNum])) { if (!empty($config)) {