您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
public function alist() { $this->validateLogin(); $this->createurl(); $article = M('article'); $page = I('get.page'); $perpage = 20; $page = (isset($page) && ($page>0)) ? $page : 1;//current page $last = $page - 1; $next = $page + 1; $url = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?page="; $sum = count($article->where("is_delete=0")->select()); $pages = ceil($sum/$perpage); $this->assign('sum',$sum); $this->assign('pages' ,$pages); if ($page > 1) { $arr = "<a href='" . $url . "1''>首页</a>"; $arr .= "<a href='" . $url . $last . "''>上一页</a>"; } else { $arr = "<a href='javascript:void(0)' class='noallow'>首页</a>"; $arr .= "<a href='javascript:void(0)' class='noallow'>上一页</a>"; } if ( ($page-2)>0 ) { $arr .= "<a href='" . $url . $last . "'' class=\"number\">" . ($page-2) . "</a>"; $arr .= "<a href='" . $url . $last . "'' class=\"number\">" . ($page-1) . "</a>"; } else if( (($page-2)<=0) && (($page-1)>0) ) { $arr .= "<a href='" . $url . $last . "'' class=\"number\">" . ($page-1) . "</a>"; } $arr .= "<a href='" . $url . $last . "'' class=\"number current\">" . ($page) . "</a>"; if ( ($page+1)<=$pages ) { $arr .= "<a href='" . $url . $next . "'' class=\"number\">" . ($page+1) . "</a>"; if ( ($page+2)<=$pages ) { $arr .= "<a href='" . $url . $next . "'' class=\"number\">" . ($page+2) . "</a>"; } } if ($page < $pages) { $arr .= "<a href='" . $url . $next . "''>下一页</a>"; $arr .= "<a href='" . $url . $pages . "''>尾页</a>"; } else { $arr .= "<a href='javascript:void(0)' class='noallow'>下一页</a>"; $arr .= "<a href='javascript:void(0)' class='noallow'>尾页</a>"; } $this->assign('page',$arr); $data = $article->where("is_delete=0")->page($page,$perpage)->select(); $this->assign('article',$data); $this->display(); }
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。