search
Homephp教程php手册强大php 分页代码类

强大php 分页代码类

Jun 13, 2016 am 11:22 AM
discuzphpforcodePaginationpowerfulsupplyTutorialfriendofkindtypeforumstyle

本教程为各位朋友提供一款类型discuz论坛风格的分页代码了,我们把这段代码写成了一个函数哦,下面来看看吧。

本教程为各位朋友提供一款类型discuz论坛风格的分页代码了,我们把这段代码写成了一个函数哦,下面来看看吧。

//分页当页面数
 function getPage($page,$pageSize){
  $this->getRowsCount();
  $this->getPageCount($pageSize);
  //print $this->pageCount;
  if(($page =="") || ($page   $this->notePage = "1";
  }else if($page>$this->pageCount){
   $this->notePage = $this->pageCount;
  }else{
   $this->notePage = $page;
  }
  return $this->notePage;
 }
 
 //取得记录总数
 function  getRowsCount(){  
  $this->getRes($this->sql_number);
  $row = $this->getRows();
  $this->number = $row[0];
  return $this->number;
 }
 
 //取得页面数量
 
 function getPageCount($pageSize){
  $this->pageCount = ceil($this->number/$pageSize);
  return $this->pageCount;
 }
 
 //分页代码
 function getPageContent($page,$url,$pageSize){
  if($page=="1"){
   $view.=" [首页]";
   $view.=" [上一页]";
  }else{
   $view.=" [首页]";
   $view.=" [上一页]";
  }
  if($pagepageCount){
   $view.=" [下一页]";
   $view.=" [尾页]";
  }else{
   $view.=" [下一页]";
   $view.=" [尾页]";
  }
  return $view."  当前第".$page."页/共".$this->pageCount."页 ".$this->number."条记录"." 前往第 ".$this->getUrl($url,$page);
 }
 
 //分页转至页面
 function getUrl($url,$page){
  $go ="
     ";
  return $go;
 }
 
 //跳转页面
 function refUrl($url,$speak){
  print("");
 }
 


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version