改进Query类的view方法

This commit is contained in:
thinkphp
2016-05-24 22:33:52 +08:00
parent 53c3312b02
commit 44e86a7f53

View File

@@ -662,11 +662,11 @@ class Query
$fields = []; $fields = [];
if (is_array($join)) { if (is_array($join)) {
// 支持数据表别名 // 支持数据表别名
list($join, $alias) = $join; list($join, $alias, $table) = array_pad($join, 3, '');
} else { } else {
$alias = $join; $alias = $join;
} }
$table = $this->getTable($join); $table = !empty($table) ? $table : $this->getTable($join);
if (is_string($field)) { if (is_string($field)) {
$field = explode(',', $field); $field = explode(',', $field);
} }