thinkPHP3.2.3搜素功能怎么做?以下到底哪里出错了呢
public function index(){
$article=D('article');
$keyboard=isset($_GET['keyboard'])?$_GET['keyboard']:'';
$where=[]; //搜索条件
if($keyboard){ //判断是否为空
$where['keyboard']=['like',"%$keyboard%"];
}
$count= $article->where($where)->count();// 查询满足要求的总记录数
$Page = new \Think\Page($count,5);// 实例化分页类 传入总记录数和每页显示的记录数(25)
$show = $Page->show();// 分页显示输出
$list = $article->where($where)->order('time desc')->limit($Page->firstRow.','.$Page->listRows)->select();
$this->assign('list',$list);// 赋值数据集
$this->assign('page',$show);// 赋值分页输出
$this->display();