mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 23:52:49 +08:00
改进Query类的column对没有查询到数据的处理
This commit is contained in:
@@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: liu21st <liu21st@gmail.com>
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace think\config\driver;
|
|
||||||
|
|
||||||
interface ConfigInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解析配置
|
|
||||||
* @access public
|
|
||||||
* @param mixed $config 配置
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function parse($config);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace think\config\driver;
|
namespace think\config\driver;
|
||||||
|
|
||||||
class Ini implements ConfigInterface
|
class Ini
|
||||||
{
|
{
|
||||||
public function parse($config)
|
public function parse($config)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace think\config\driver;
|
namespace think\config\driver;
|
||||||
|
|
||||||
class Xml implements ConfigInterface
|
class Xml
|
||||||
{
|
{
|
||||||
public function parse($config)
|
public function parse($config)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ class Query
|
|||||||
$result = $pdo->fetchAll(PDO::FETCH_COLUMN);
|
$result = $pdo->fetchAll(PDO::FETCH_COLUMN);
|
||||||
} else {
|
} else {
|
||||||
$resultSet = $pdo->fetchAll(PDO::FETCH_ASSOC);
|
$resultSet = $pdo->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
if ($resultSet) {
|
||||||
$fields = array_keys($resultSet[0]);
|
$fields = array_keys($resultSet[0]);
|
||||||
$count = count($fields);
|
$count = count($fields);
|
||||||
$key1 = array_shift($fields);
|
$key1 = array_shift($fields);
|
||||||
@@ -151,6 +152,9 @@ class Query
|
|||||||
$result[$val[$key]] = $val[$key2];
|
$result[$val[$key]] = $val[$key2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$result = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isset($cache)) {
|
if (isset($cache)) {
|
||||||
// 缓存数据
|
// 缓存数据
|
||||||
|
|||||||
Reference in New Issue
Block a user