thinkphp5.0 分页+搜索方法
$where = 1;
$keyword = input("param.keyword");
$keyword && $where = "(channel_name like '%$keyword%') OR (live_name like '%$keyword%')";
$list = Db::name('live_channel')
->where($where)
->where('is_delete','0')
->order('id','desc')
->paginate(10, false, ['query' => ['keyword' => $keyword]]);
$pages = $list->render();
$this->assign('lists',$list);
$this->assign('keyword',$keyword);
$this->assign('page',$pages);
return $this->fetch();
其他几位友友的方法: http://www.thinkphp.cn/topic/45181.html http://www.thinkphp.cn/topic/39038.html