改进Query类的column方法 支持 field和key相同的情况

This commit is contained in:
thinkphp
2016-06-15 11:44:21 +08:00
parent d08ae3671a
commit c88bcf45ad
2 changed files with 3 additions and 1 deletions

View File

@@ -331,7 +331,7 @@ class App
private static function init($module = '') private static function init($module = '')
{ {
// 定位模块目录 // 定位模块目录
$module = ($module) ? $module . DS : ''; $module = $module ? $module . DS : '';
// 加载初始化文件 // 加载初始化文件
if (is_file(APP_PATH . $module . 'init' . EXT)) { if (is_file(APP_PATH . $module . 'init' . EXT)) {

View File

@@ -447,6 +447,8 @@ class Query
$result[$val[$key]] = $val; $result[$val[$key]] = $val;
} elseif (2 == $count) { } elseif (2 == $count) {
$result[$val[$key]] = $val[$key2]; $result[$val[$key]] = $val[$key2];
} elseif (1 == $count) {
$result[$val[$key]] = $val[$key1];
} }
} }
} else { } else {