php爱好者们都会很喜欢各种各样的面向对象源码,调用方面一耗即用,哈分页数据显示,只不过针对于小的功能模块儿 那么不多说了 直接上源码,
n年以后的今天 小寒还是发现 没有注释代码的好习惯,唉 这个方面很有欠缺,在做php教程的同时是很有欠缺的 不过依然还是上源码来解释了
class page{
private $pagesize;
private $page;
private $total;
private $conn;
private $pagecount;
public function __construct($pagesize,$page){
$this->pagesize = $pagesize;
$this->page = $page;
}
public function listinfo(){
if ($this->page = ""||!is_numeric($this->page)){
$this->page = 1;//赋初值的过程
}
$this->conn = mysql_connect("localhost","root","");
mysql_select_db("user",$this->conn);
mysql_query("set names utf8");
$sql = mysql_query("select count(*) as total from user_student",$this->conn);
$info = mysql_fetch_array($sql);
if ($this->total == 0){
echo "暂无内容";
}else {
if ($this->total%$this->page == 0){
$this->pagecount = intval($this->total/$this->pagesize);
}else {
if ($this->total<=$this->pagesize){
$this->pagecount = 1;
}else {
$this->pagecount = ceil($this->total/$this->pagesize);
}
}
}
}
}
?>
以上就是php面向对象分页数据显示的内容,更多相关内容请关注PHP中文网(www.php.cn)!

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境

SecLists
SecLists是最终安全测试人员的伙伴。它是一个包含各种类型列表的集合,这些列表在安全评估过程中经常使用,都在一个地方。SecLists通过方便地提供安全测试人员可能需要的所有列表,帮助提高安全测试的效率和生产力。列表类型包括用户名、密码、URL、模糊测试有效载荷、敏感数据模式、Web shell等等。测试人员只需将此存储库拉到新的测试机上,他就可以访问到所需的每种类型的列表。

Dreamweaver Mac版
视觉化网页开发工具

Dreamweaver CS6
视觉化网页开发工具

SublimeText3汉化版
中文版,非常好用