$uid=11;
$muid=13;
$yymsg=Db::table('p_message')
->alias('t1')
->join('user t2','t1.muid = t2.uid')
->where(['t1.muid'=>$uid,'t1.uid'=>$muid])
->whereOr(['t1.muid'=>$muid,'t1.uid'=>$uid])
->select();
但得到的where条件长这样(WHERE t1
.muid
= 11 AND t1
.uid
= 13 OR t1
.muid
= 13 OR t1
.uid
= 11),
想要的where条件是这样(WHERE t1
.muid
= 11 AND t1
.uid
= 13 OR t1
.muid
= 13 AND t1
.uid
= 11),应该怎么写
$where = ['t1.muid'=>$muid,'t1.uid'=>$uid];
$yymsg=Db::table('p_message')
->alias('t1')
->join('user t2','t1.muid = t2.uid')
->where(['t1.muid'=>$uid,'t1.uid'=>$muid])
->whereOr(function($query)use($where){
$query->where($where);
})
->select();
这样出来的就是正确的了