//单一条件排序
$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();
//tp5.1
Db::table('think_user')
->where('status', 1)
->order(['order','id'=>'desc'])
->limit(5)
->select();
tp5 order 多条件排序
最新推荐文章于 2024-09-05 10:51:55 发布