企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 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(); ```