总结如下:
//单一条件排序
$user = $this->where(['parentId'=>0)->field('userId,userName,userSort,isShow')->order('userSort', 'asc')->select();
//多个条件排序,可以多加一个order
$user = $this->where(['parentId'=>0)->field('userId,userName,userSort,isShow')->order('userSort', 'asc')->order('userId', 'asc')->select();
//多个条件排序,还可以都写到order里面
$user = $this->where(['parentId'=>0)->field('userId,userName,userSort,isShow')->order('userSort', 'asc')->order('userSort asc,userId asc')->select();
thinkphp5.1官方文档order多字段排序
Db::table('think_user')
->where('status', 1)
->order(['order','id'=>'desc'])
->limit(5)
->select();
网址https://www.kancloud.cn/manual/thinkphp5_1/354012