php 数组分页
$p = max(1, I('param.p',1,'intval'));
$count = count($date);
$Page = new Page($count,15);
$Page->setConfig('theme','<li class="head">共%TOTAL_ROW%条记录</li> %FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% <li class="ender">共 %TOTAL_PAGE%页,当前显示第'.$p.'页</li>'); $lists = array_slice($date, $Page->firstRow,$Page->listRows);
$pages = $Page->show(); $this->assign('pages',$pages);
$this->assign('list',$lists);
$this->assign('p', $p);
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="formtable oelight" style="margin-top:10px;margin-bottom:100px;">
<thead>
<tr>
<th>name</th>
<th>dw</th>
<th>jj</th>
<th>wts</th>
<th>jjs</th>
</tr>
</thead>
<tbody>
<?php if(empty($list)){?>
<tr>
<td colspan="5" style="border-right:0px;">暂无信息记录</td>
</tr>
<?php }else{foreach($list as $info){?>
<tr>
<td><?php echo $users[$info['tid']];?></td> <td>
<?php echo $dpts[$info['code']]?>
</td>
<td><?php echo $users1[$info['toid']];?> </td>
<td>
<?php echo $info['zs']?>
</td>
<td style="border-right:0px;">
<?php echo empty($info['my'])?0:$info['my'];?>
</td>
</tr>
<?php }?>
<?php }?>
<tr>
<td colspan="3" style="border-right:0px;border-top:1px solid #eee;text-align:right;">
<?php echo $pages;?>
</td>
</tr>
</tbody>
</table>
php 数组分页的更多相关文章
- PHP中的数组分页实现(非数据库)
在日常开发的业务环境中,我们一般都会使用 MySQL 语句来实现分页的功能.但是,往往也有些数据并不多,或者只是获取 PHP 中定义的一些数组数据时需要分页的功能.这时,我们其实不需要每次都去查询数据 ...
- 基于thinkphp的数组分页
function array_page($array,$rows){ import("ORG.Util.Page"); //导入分页类 $count=count($array); ...
- php数组分页类
<?php class ArrayPage{ public $totalPage;//全部页数 public $lists;//每页显示数目 public $arr = array();//分页 ...
- laravel手动数组分页
laravel文档中已经有写如何自己使用分页类去分页了,但没有详细说明. 如果你想手动创建分页实例并且最终得到一个数组类型的结果,可以根据需求来创建 IlluminatePaginationPagin ...
- TP5 数组分页
需要 use think\Page; 我这个是 Page是从tp3.2的移到5.0来用的,如果你的里面没有这个也可以移动过来 PHP代码: $page= $this->request->p ...
- thinkphp几个表的数据合并,并用数组分页
控制器: //金币扣除 public function jbkc(){ $map['UG_dataType']= 'xtkc'; $list1 = M ( 'userget' )->where ...
- php数据库两个关联大表的大数组分页处理,防止内存溢出
$ret = self::$db->select($tables, $fields, $where, $bind); if (!empty($ret)) { $retIds = array(); ...
- javascript对数组分页
function pagination(pageNo, pageSize, array) { var offset = (pageNo - 1) * pageSize; return (offset ...
- laravel 框架给数组分页
//Get current page form url e.g. &page=6 $currentPage = LengthAwarePaginator::resolveCurr ...
随机推荐
- iOS Masonry 抗压缩 抗拉伸
约束优先级: 在Autolayout中每个约束都有一个优先级, 优先级的范围是1 ~ 1000.创建一个约束,默认的优先级是最高的1000 Content Hugging Priority: 该优先级 ...
- 隐藏VS2013的反馈、通知和登录按钮
Visual Studio 2013的右上角有反馈.通知.登录.快速启动等按钮,在VS2013中没有选项可以设置为隐藏. 打开注册表(开始 -> 运行 -> regedit),展开到以下路 ...
- shadow密码文件
登录Linux会要求输入用户名和密码.通常本地文件中会存储一份用户密码,并与用户输入对比,如果相同就允许用户登录.起初用户密码存储与/etc/passwd中,但由于/etc/passwd必须供所有用户 ...
- git 和 svn 的比较
Git VS SVN 1 .功能 主体功能 Git SVN 1.从服务器上克隆完整的Git仓库(包括代码和版本信息)到单机上. 1 .SVN是基于关系数据库的(BerkleyDB)或一系列二进制 ...
- Java Web开发笔记
问题: 读取资源文件问题 servletContext.getRealPath() servletContext.getResouce().getPath() setvletContext.getRe ...
- Eclipse中Copy Qualified Name复制类全名解决办法
Eclipse中用Copy Qualified Name复制类全名时总是这样的/struts1/src/me/edu/HelloAction.java很不方便可以这样解决下载下边插件解压到Eclips ...
- 如何在github上发起一个pull request,如何贡献代码,参与开源项目
点击页面右上角的 “fork” ,把你关注的项目fork到你自己的账号下了. 把项目克隆到本地 修改并push 回到你的github界面,发起请求: 在自己fork的库处新建请求:New pull r ...
- 使用Highcharts实现柱状图展示
第一步 新建页面line.html,引入HighCharts核心js文件 <script type="text/javascript" src="../../js/ ...
- unity批量修改AssetBundleName与Variant
批量修改指定路径下的资源的AssetBundleName与Variant. 脚本代码如下: using System.Collections; using System.Collections.Gen ...
- 【POJ-2524】Ubiquitous Religions(并查集)
并查集. #include<cstdio> #include<cstring> using namespace std; const int maxn = 55555; int ...