thinkphp5.0搜索+分页教程,主要是以下这句代码,记录搜索值
->paginate(1,false,$config = ['query'=>array('searchkey'=>$searchkey)]);(记录搜索值)
代码如下:
public function search(){ $where['title'] = array('like','%'.$searchkey.'%'); $result= \think\Db::name('note')->where($where)->paginate(1,false,$config = ['query'=>array('searchkey'=>$searchkey)]); // halt($_SESSION); $this->assign('result',$result); return $this->fetch(); } public function jg(){ return $this->fetch(); }
文章评论(0)