/**
* 查询SQL组装 join
* @access public
* @param mixed $join 关联的表名
* @param mixed $condition 条件
* @param string $type JOIN类型
* @return $this
*/
public function join($join, $condition = null, $type = 'INNER')
{
if (empty($condition)) {
// 如果为组数,则循环调用join
foreach ($join as $key => $value) {
if (is_array($value) && 2 <= count($value)) {
$this->join($value[0], $value[1], isset($value[2]) ? $value[2] : $type);
}
}
} else {
$table = $this->getJoinTable($join);
$this->options['join'][] = [$table, strtoupper($type), $condition];
}
return $this;
}
临时改成如下就可以了 /**
* 查询SQL组装 join
* @access public
* @param mixed $join 关联的表名
* @param mixed $condition 条件
* @param string $type JOIN类型
* @return $this
*/
public function join($join, $condition = null, $type = 'INNER')
{
$this->options['join'] = array();
if (empty($condition)) {
// 如果为组数,则循环调用join
foreach ($join as $key => $value) {
if (is_array($value) && 2 <= count($value)) {
$this->join($value[0], $value[1], isset($value[2]) ? $value[2] : $type);
}
}
} else {
$table = $this->getJoinTable($join);
$this->options['join'][] = [$table, strtoupper($type), $condition];
}
return $this;
}
最佳答案
