diff --git a/library/think/config/driver/ConfigInterface.php b/library/think/config/driver/ConfigInterface.php deleted file mode 100644 index c38727c9..00000000 --- a/library/think/config/driver/ConfigInterface.php +++ /dev/null @@ -1,25 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\config\driver; - -interface ConfigInterface -{ - - /** - * 解析配置 - * @access public - * @param mixed $config 配置 - * @return mixed - */ - public function parse($config); - -} diff --git a/library/think/config/driver/Ini.php b/library/think/config/driver/Ini.php index 61a49df6..d8dc558d 100644 --- a/library/think/config/driver/Ini.php +++ b/library/think/config/driver/Ini.php @@ -11,7 +11,7 @@ namespace think\config\driver; -class Ini implements ConfigInterface +class Ini { public function parse($config) { diff --git a/library/think/config/driver/Xml.php b/library/think/config/driver/Xml.php index 6cbd82bc..5bc93015 100644 --- a/library/think/config/driver/Xml.php +++ b/library/think/config/driver/Xml.php @@ -11,7 +11,7 @@ namespace think\config\driver; -class Xml implements ConfigInterface +class Xml { public function parse($config) { diff --git a/library/think/db/Query.php b/library/think/db/Query.php index c7a5fc78..1483eb5e 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -139,17 +139,21 @@ class Query $result = $pdo->fetchAll(PDO::FETCH_COLUMN); } else { $resultSet = $pdo->fetchAll(PDO::FETCH_ASSOC); - $fields = array_keys($resultSet[0]); - $count = count($fields); - $key1 = array_shift($fields); - $key2 = $fields ? array_shift($fields) : ''; - $key = $key ?: $key1; - foreach ($resultSet as $val) { - if ($count > 2) { - $result[$val[$key]] = $val; - } elseif (2 == $count) { - $result[$val[$key]] = $val[$key2]; + if ($resultSet) { + $fields = array_keys($resultSet[0]); + $count = count($fields); + $key1 = array_shift($fields); + $key2 = $fields ? array_shift($fields) : ''; + $key = $key ?: $key1; + foreach ($resultSet as $val) { + if ($count > 2) { + $result[$val[$key]] = $val; + } elseif (2 == $count) { + $result[$val[$key]] = $val[$key2]; + } } + } else { + $result = []; } } if (isset($cache)) {