table方法支持字符串方式的子查询

This commit is contained in:
thinkphp
2016-11-12 11:11:18 +08:00
parent a924186ce6
commit 310775471a

View File

@@ -1050,7 +1050,10 @@ class Query
public function table($table)
{
if (is_string($table)) {
if (strpos($table, ',')) {
if (strpos($table, ')')) {
// 子查询
$table = $table;
} elseif (strpos($table, ',')) {
$tables = explode(',', $table);
$table = [];
foreach ($tables as $item) {