Thinkphp3.2.3’s paging problem is similar to Tieba. How many floors are there? I used a foreach loop and used the loop key value + 1 to achieve the first page of 1-10 floors. There is no Question, but when you go to the second floor, it is not the 11-20 floors, but the 1-10 floors. How can you solve this? I printed out the second page because it also started from the 0 key value, so it also ended up on floors 1-10
$count = $model_forum->where($forum_data)->count();//Query the total number of records that meet the requirements $map represents the query conditions
$Page = new \Think\Page($count,10);// 实例化分页类 传入总记录数和每页显示的记录数(25)
$show = $Page->show();// 分页显示输出
// 进行分页数据查询
$list = $model_forum->where($forum_data)->order('id')->limit($Page->firstRow.','.$Page->listRows)->select(); // $Page->firstRow 起始条数 $Page->listRows 获取多少条
$this->assign('fenye',$list);// 赋值数据集
$this->assign('page',$show);// 赋值分页输出
Why do you write limit() like this? Why not just limit($page->firstRow,$page->listRows)?