通过数组项分页
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了通过数组项分页相关的知识,希望对你有一定的参考价值。
There are plenty of classes out there to paginate through database results, well, here's one to paginate through a static array of items. Written quite a few years ago, recently recovered from a crashed drive.
<?php class Paginate_Array { var $_array; var $_per_page; var $_lpage; var $_offset; function Paginate_Array($array, $offset = 0, $per_page = 3) { $this->_array = $array; $this->_per_page = $per_page; $this->_offset = $offset; } function getOffset() { } function getPages() { for ($i=0; $i <= ($this->_lpage - 1); $i++) { $this->_out[$i+1] = $i * $this->_per_page; } return $this->_out; } function _getLastOffset() { $_arr = $this->_out; } function hasPrev($text) { return ($this->_offset > 0) ? $text : ''; } function hasNext($text) { return ($this->_offset < self::_getLastOffset()) ? $text : ''; } } // end class ?>
以上是关于通过数组项分页的主要内容,如果未能解决你的问题,请参考以下文章
FragmentStatePagerAdapter视图分页器片段在重新创建活动后未显示