YII2 Where 不特定个数多条件查询
eg:
$where= ['AND'];
$where[] = ['title' => $set_menu['title'],'type' => $type];
if (!empty($id)) {
$where[] = ['<>', 'id', $id];
}
....->Where($where)->....
eg:
$where= ['AND'];
$where[] = ['title' => $set_menu['title'],'type' => $type];
if (!empty($id)) {
$where[] = ['<>', 'id', $id];
}
....->Where($where)->....