thinkphp带查询条件的分页

时间:2023-03-08 17:12:34
thinkphp带查询条件的分页
<!DOCTYPE HTML>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<style type='text/css'>
.meneame a{
    background: #3083EB;
    text-align: center;
    color: #fff;
    padding: 4px 10px;
    display: inline;
    cursor: pointer;
}
.meneame{text-align: right;}
.meneame .current {
    background: url("0");
    width: auto;
    display: inline;
    padding: 4px 10px;
    border: 0;
}
</style>
<body>
    <div class="meneame">{$page}</div>
</body>
</html>

<?php
$search_factory_infos=trim($this->_request('search_factory_infos'));
$where['account']=array('like',"%$search_factory_infos%");
import('ORG.Util.Page');// 导入分页类
$Page = new Page($count,10);// 实例化分页类 传入总记录数和每页显示的记录数
//分页跳转的时候保证查询条件
foreach($where as $key=>$val){
    if(!is_array($val)){
        $Page->parameter .="$key=".urlencode($val)."&";//赋值给Page
    }
}
$show  = $Page->show();// 分页显示输出
$list=M('user_set_facorder')->where($where)->limit($Page->firstRow . ',' . $Page->listRows)->select();
?>