自己美化的分页代码分享
先看看效果
代码部分://设置分页查询<br><br>
$Data = M('think.Huodong_fenlei'); // 实例化Data数据对象<br>
import('ORG.Util.Page');// 导入分页类<br>
$count = $Data->where($map)->count();// 查询满足要求的总记录数<br>
$Page = new Page($count,1);// 实例化分页类 传入总记录数并且每页显示5条记录<br>
$nowPage = isset($_GET['p'])?$_GET['p']:1;<br>
$list = $Data->where($map)->order('addtime desc')->page($nowPage.','.$Page->listRows)->select();<br>
$show = $Page->show();// 分页显示输出<br>
$this->assign('page',$show);// 赋值分页输出<br>
$this->assign('list',$list);// 赋值数据集 <br>
$this->display();CSS部分.result.page {<br>
height: 40px;<br>
width: auto;<br>
text-align: center;<br>
line-height: 40px;<br>
padding-right: 30px;<br>
padding-left: 30px;<br>
margin: 15px auto 30px;<br><br>
}<br><br>
.result.page a {<br>
height: 25px;<br>
width: auto;<br>
display: inline-block;<br>
color: #333;<br>
border: 1px solid #CCC;<br>
text-decoration: none;<br>
line-height: 25px;<br>
padding-left: 5px;<br>
padding-right: 5px;<br>
background-color: #F9F9F9;<br>
}<br>
.result.page .current {<br>
height: 25px;<br>
width: auto;<br>
padding-left: 8px;<br>
padding-right: 8px;<br>
line-height: 25px;<br>
display: inline-block;<br>
background-color: #09F;<br>
color: #FFF;<br>
}<br>
.result.page a:hover {<br>
background-color: #09F;<br>
color:#FFF;<br>
border: 1px solid #09F;<br>
}
page.zip
( 8.4 KB 下载:118 次 )
AD:真正免费,域名+虚机+企业邮箱=0元
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
C++高性能并发应用_C++如何开发性能关键应用
Java AI集成Deep Java Library_Java怎么集成AI模型部署
Golang后端API开发_Golang如何高效开发后端和API
Python异步并发改进_Python异步编程有哪些新改进
C++系统编程内存管理_C++系统编程怎么与Rust竞争内存安全
Java GraalVM原生镜像构建_Java怎么用GraalVM构建高效原生镜像
Python FastAPI异步API开发_Python怎么用FastAPI构建异步API
C++现代C++20/23/26特性_现代C++有哪些新标准特性如modules和coroutines
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号