分页类——尾部页码导航
<?php /** * 生成Comment的尾部分页导航 * @author 李俊 * */ class cmtTail{ private $currentPage; private $totalPage; /** * 生成页码导航--总控函数 * @param string $currentPage 当前页码 * @param string $totalPage 总页数 * @throws Exception 页码小于1将会抛出异常 * @return string */ function __do($currentPage, $totalPage) { $this->currentPage=$currentPage; $this->totalPage=$totalPage; if($this->totalPage<=10){//总页数小于等于10页 if($this->currentPage==1){//当前页是第一页 $str='上一页'.$this->currentTag(); for ($i = 2; $i <= $this->totalPage; $i++) { $str=$str.$this->commonTag($i); } $str=$str.$this->next(); }elseif ($this->currentPage==$this->totalPage){//已跳至最后一页 $str=$this->up(); for ($i = 1; $i <= $this->totalPage-1; $i++) { $str=$str.$this->commonTag($i); } $str=$str.$this->currentTag(); $str=$str.$this->next(); }else{ $str=$this->up(); for($i=1; $i<$this->currentPage; $i++){ $str=$str.$this->commonTag($i); } $str=$str.$this->currentTag();//生成当前页标签 for ($i = $this->currentPage+1; $i <= $this->totalPage; $i++) { $str=$str.$this->commonTag($i); } $str=$str.$this->next(); } }elseif ($this->totalPage>10){//页码大于10 if($this->currentPage==1){//8+2 $str='上一页'.$this->currentTag(); for ($i = 2; $i <= 8; $i++) { $str=$str.$this->commonTag($i); } $str=$str.'...';//添加省略号 $str=$str.$this->commonTag($this->totalPage-1); $str=$str.$this->commonTag($this->totalPage); }elseif($this->currentPage==$this->totalPage) {//当前为最后一页 $str=$this->up(); $str=$str.$this->commonTag(1); $str=$str.'...';//添加省略号 for ($i = $this->totalPage-6; $i < $this->totalPage; $i++) { $str=$str.$this->commonTag($i); } $str=$str.$this->currentTag(); $str=$str.$this->next(); }else { if ($this->currentPage<6) { $str=$this->up(); for ($i = 1; $i < $this->currentPage; $i++) { $str=$str.$this->commonTag($i); } $str=$str.$this->currentTag(); for ($i = $this->currentPage+1; $i <= 7; $i++) { $str=$str.$this->commonTag($i); } $str=$str.'...';//添加省略号 $str=$str.$this->commonTag($this->totalPage); $str=$str.$this->next(); }else { if ($this->currentPage>=$this->totalPage-4) { $str=$this->up(); $str=$str.$this->commonTag(1); $str=$str.'...';//添加省略号 for ($i = $this->totalPage-6; $i < $this->currentPage; $i++) { $str=$str.$this->commonTag($i); } $str=$str.$this->currentTag(); for ($i = $this->currentPage+1; $i <= $this->totalPage; $i++) { $str=$str.$this->commonTag($i); } $str=$str.$this->next(); }elseif ($this->currentPage<$this->totalPage-4){//1+5+1 $str=$this->up(); $str=$str.$this->commonTag(1); $str=$str.'...';//添加省略号 $str=$str.$this->commonTag($this->currentPage-2); $str=$str.$this->commonTag($this->currentPage-1); $str=$str.$this->currentTag(); $str=$str.$this->commonTag($this->currentPage+1); $str=$str.$this->commonTag($this->currentPage+2); $str=$str.'...';//添加省略号 $str=$str.$this->commonTag($this->totalPage); $str=$str.$this->next(); } }; } }elseif ($this->totalPage<=0){ throw new Exception("页面不可能小于1"); } return $str; } /** * 一般标签 * @param int $param 页码 * @return string */ function commonTag($param) { return '<a page="'.$param.'">'.$param.'</a>'; } /** * 生成当前页标签 * @param int $param 页码 * @return string */ function currentTag() { return '<strong id="on">'.$this->currentPage.'</strong>'; } /** * 生成下一页标签 * @param int $param 下一页页码 * @return string */ function next() { if ($this->currentPage==$this->totalPage) { return '下一页'; } return '<a page="'.($this->currentPage+1).'">下一页</a>'; } /** * 生成上一页标签 * @param int $param 上一页页码 * @return string */ function up() { if ($this->currentPage==1){ return '上一页'; }else{ return '<a page="'.($this->currentPage-1).'">上一页</a>'; } } /** * 实例化cmtTail, * 功能:生成Comment的尾部分页导航 * @param string $currentPage 当前页码 * @param string $totalPage 总页数 * @return string 返回html标签字符串 */ static function GO($currentPage, $totalPage) { $p=new cmtTail(); return $p->__do($currentPage, $totalPage); } }

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

에디트플러스 중국어 크랙 버전
작은 크기, 구문 강조, 코드 프롬프트 기능을 지원하지 않음

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SecList
SecLists는 최고의 보안 테스터의 동반자입니다. 보안 평가 시 자주 사용되는 다양한 유형의 목록을 한 곳에 모아 놓은 것입니다. SecLists는 보안 테스터에게 필요할 수 있는 모든 목록을 편리하게 제공하여 보안 테스트를 더욱 효율적이고 생산적으로 만드는 데 도움이 됩니다. 목록 유형에는 사용자 이름, 비밀번호, URL, 퍼징 페이로드, 민감한 데이터 패턴, 웹 셸 등이 포함됩니다. 테스터는 이 저장소를 새로운 테스트 시스템으로 간단히 가져올 수 있으며 필요한 모든 유형의 목록에 액세스할 수 있습니다.

MinGW - Windows용 미니멀리스트 GNU
이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.

ZendStudio 13.5.1 맥
강력한 PHP 통합 개발 환경
