Home  >  Article  >  Backend Development  >  thinkphp自带的分页,当前页是什么?该怎么处理

thinkphp自带的分页,当前页是什么?该怎么处理

WBOY
WBOYOriginal
2016-06-13 11:53:231104browse

thinkphp自带的分页,当前页是什么?
thinkphp自带的分页,当前页是Page.class.php里的$nowPage,怎样在前台页面显示?
换句话说,前台{$page}是显示分页的,上一页,下一页,共XXX页都在这显示。我需要在另外一个地方只显示当前页
------解决方案--------------------
page 类有
    // 当前页数
    protected $nowPage    ;
这是一个保护型属性,不可在类外访问
如果你一定要使用,则可以将其改为 public 的
如果你不想修改原始的库代码
可以从 page 类继承一个工作类

class myPage extends Page {<br />  function get_nowPage() {<br />    return $this->nowPage;<br />  }<br />}<br />
使用时用这个类替换原来的 page 类

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn