时间:2021-07-01 10:21:17 帮助过:2人阅读
/** * * @param $_sql * @param $_size */function _page($_sql,$_size) { //将里面的所有变量取出来,外部可以访问 global $_page,$_pagesize,$_pagenum,$_pageabsolute,$_num; if (isset($_GET['page'])) { $_page = $_GET['page']; if (empty($_page) || $_page < 0 || !is_numeric($_page)) { $_page = 1; } else { $_page = intval($_page); } } else { $_page = 1; } $_pagesize = $_size; $_num = _num_rows(_query($_sql)); if ($_num == 0) { $_pageabsolute = 1; } else { $_pageabsolute = ceil($_num / $_pagesize); } if ($_page > $_pageabsolute) { $_page = $_pageabsolute; } $_pagenum = ($_page - 1) * $_pagesize;}/** * _paging分页函数 * @param $_type * @return 返回分页 */function _paging($_type) { global $_page,$_pageabsolute,$_num; if ($_type == 1) { echo ''; echo ''; for ($i=0;$i<$_pageabsolute;$i++) { if ($_page == ($i+1)) { echo '
+1).'" class="selected">'.($i+1).''; } else { echo '- $i
在核心函数库包装以上代码glob.funic.php
然后只要在文件中调用以下函数就行:
//_pageing函数调用分页,1|2,1表示数字分页,2表示文本分页
_paging(2);
?>