thinkphp 3.2 URL显示分页后面参考显示[page]没有参数
代码如下:应该怎么修改?publicfunctionnewsHome(){$id=I('get.id');if($id){$navs=D('Nav')->where(ar...
代码如下:应该怎么修改? public function newsHome(){ $id = I('get.id'); if ($id) { $navs = D('Nav')->where(array('id'=>$id))->find(); $where = array('type'=>$id,'display'=>1); }else{ $navs = D('Nav')->where(array('url'=>'news'))->find(); $where = array('display'=>1); } $news_db = D('News'); $count = $news_db->where($where)->count();// 查询满足要求的总记录数 $Page = new \Think\PageHome($count,8);// 实例化分页类 $Page->setConfig('theme','%HEADER% %FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END%'); if ($id) { $Page->setConfig('link',"/news/".$id."?p=zz"); }else{ $Page->setConfig('link',"/news?p=zz"); } $show = $Page->show();// 分页显示输出 $list = $news_db->where($where)->order('`addtime` desc')->limit($Page->firstRow.','.$Page->listRows)->select(); //banner $banner = D('Slide')->where(array('title'=>"新闻资讯"))->find(); $navs['banner'] = $banner['img']; $this->assign("list",$list); $this->assign("page",$show); $this->assign("navs",$navs); $this->redis(); $this->display(); }
展开
2个回答
展开全部
<?php
function newsHome()
{
$id = I('get.id');
if ($id) {
$navs = D('Nav')->where(array('id' => $id))->find();
$where = array('type' => $id, 'display' => 1);
} else {
$navs = D('Nav')->where(array('url' => 'news'))->find();
$where = array('display' => 1);
}
$news_db = D('News');
$count = $news_db->where($where)->count(); // 查询满足要求的总记录数
$Page = new \Think\PageHome($count,8);// 实例化分页类
$Page->setConfig('theme','%HEADER% %FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END%');
if ($id) {
$Page->setConfig('link',"/news/".$id."?p=zz");
}else{
$Page->setConfig('link',"/news?p=zz");
}
$show = $Page->show();// 分页显示输出
$list = $news_db->where($where)->order('`addtime` desc')->limit($Page->firstRow.','.$Page->listRows)->select(); //banner
$banner = D('Slide')->where(array('title'=>"新闻资讯"))->find();
$navs['banner'] = $banner['img'];
$this->assign("list",$list);
$this->assign("navs",$navs);
$this->assign("page",$show);
//$this->redis();
$this->display();
}
?>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2018-10-11
展开全部
没看懂p=zz,是什么意思?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询