改进table方法的解析

This commit is contained in:
thinkphp
2016-10-06 20:37:12 +08:00
parent e6976918de
commit 32e001cdc6
2 changed files with 22 additions and 15 deletions

View File

@@ -1049,6 +1049,17 @@ class Query
list($table, $alias) = explode(' ', $table);
$this->alias([$table => $alias]);
}
} else {
$tables = $table;
$table = [];
foreach ($tables as $key => $val) {
if (is_numeric($key)) {
$table[] = $val;
} else {
$this->alias([$key => $val]);
$table[] = $key;
}
}
}
$this->options['table'] = $table;
return $this;