select * from table where (a = 1 or a = 2) and abc = 123;

    Db:where(abc=123)->whereOr(a = 1 or a = 2)

    select * from table where a = 1 or a = 2 and abc = 123;

    在thinkphp中是无法生成括号的

    解决办法:
    使用同一个where来进行处理

    $whereor[] = array(‘origin|destination|phonenumber’, ‘like’, “%” . $keywords . “%”,’or’);
    $whereor[] = array(‘status’, ‘=’, $selstatus);
    Supplys::where($whereor)->order(‘id’, ‘desc’)->select();

    来源:thinkphp 5 where 和 whereor一起使用 or 和 and 分组使用。