在模糊搜索的时候,会查询出所要的搜索信息,
但是只能看到第一页,点击下一页或者任意一页就会出现如下图,并返回主页面
以下是搜索功能代码
//档案搜索
public function dasousu0(){
if(session('USERNAME') == ''){
$this->redirect('login/login');
$keywords=$_POST['keywords'];
}else{
$sousu0 = input('post.sousu0');//输入的要搜索的关键字
if($sousu0 ==''){
return "<script>
alert('请输入搜索关键字!');
location.href='danganlist';
</script>";
}else{
//模糊查询
$list = db('userinfo')->where('ifzztg',0)
->where('bianhao','like','%'.$sousu0.'%')
->whereOr('danwei','like','%'.$sousu0.'%')
->whereOr('name','like','%'.$sousu0.'%')
->whereOr('tel','like','%'.$sousu0.'%')
->whereOr('card','like','%'.$sousu0.'%')
->order('id asc')->paginate(20,false,['query'=>request()->param()]);
$page = $list->render();
$listcount = db('userinfo')->where('ifzztg',0)
->where('bianhao','like','%'.$sousu0.'%')
->whereOr('danwei','like','%'. $sousu0.'%')
->whereOr('name','like','%'.$sousu0.'%')
->whereOr('tel ','like','%'.$sousu0.'%')
->whereOr('card','like','%'.$sousu0.'%')-> count();
$lb = '全部';
$qxid = session('QUANXIANID');
if($list){
return $this->fetch('dangan',['list'=>$list,'listcount'=>$listcount,'page'=>$page,'lb'=>$lb, 'qxid'=>$qxid]);
}else{
return "<script>
alert('无记录!');
location.href='danganlist';
";
}
}
}
}
各位大神,帮帮小白、、、、、
打印input的值,看有没有数据过来
检查路由