查询数据库时
$model; if(!empty($name)) { $model->andWhere(['name'=>$name]); }
可以用andFilterWhere,自动的把空的条件过滤掉
$model->andFilterWhere(['name'=>$name]);