在Thinkphp中不调用 原本的分页类,自己怎么写一个简单的分页功能出来,求代码,
1个回答
展开全部
$count = M('news')->count();
$page_num = 6;
$page_all = ceil($count/$page_num);
$page = $_GET['page'] ? $_GET['page'] : 1;
$page_up = $page-1>0 ? $page-1 : 1;
$page_down = $page+1>$page_all ? $page_all : $page+1;
$pian = ($page-1)*$page_num;
$arr = M('news')->limit(" $pian,$page_num ")->select();
$show = " 第 $page 页/共 $page_all 页,$count 条记录,
<a href = '__APP__/Index/index/page/1' >首页</a>
<a href = '__APP__/Index/index/page/'.$page_up >上一页</a>
<a href = '__APP__/Index/index/page/'.$page_down >下一页</a>
<a href = '__APP__/Index/index/page/'.$page_all>尾页</a>
";
$page_num = 6;
$page_all = ceil($count/$page_num);
$page = $_GET['page'] ? $_GET['page'] : 1;
$page_up = $page-1>0 ? $page-1 : 1;
$page_down = $page+1>$page_all ? $page_all : $page+1;
$pian = ($page-1)*$page_num;
$arr = M('news')->limit(" $pian,$page_num ")->select();
$show = " 第 $page 页/共 $page_all 页,$count 条记录,
<a href = '__APP__/Index/index/page/1' >首页</a>
<a href = '__APP__/Index/index/page/'.$page_up >上一页</a>
<a href = '__APP__/Index/index/page/'.$page_down >下一页</a>
<a href = '__APP__/Index/index/page/'.$page_all>尾页</a>
";
追问
放在哪里的呢?
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询