合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
# thinkphp 自由查询语句分页 ``` $search = I('get.k'); $sql="select a.title casetitle,a.default_pic,a.id caseid,b.title classtitle from `case` a,case_class b where a.case_class=b.id"; if (!empty($search)) { $sql=$sql." and a.title like '%$search%'"; } $q = M(); $pagesize = I('get.pagesize', 2, 'intval'); $count = count($q->query($sql));//总计条数 echo $count.$pagesize; $Page = new HelpBasePage($count, $pagesize, array(), false); // 实例化分页类 传入总记录数和每页显示的记录数(5) $list=$q->query($sql." limit $Page->firstRow,$Page->listRows"); $show = $Page->show(); $this->assign('pagination', $show); $this->assign('list', $list); $this->assign('search', $search); $this->display(); ```