CakePHP PaginatorHelper:获取当前页面
我需要页码,但似乎找不到任何相关文档。如何在 CakePHP 视图中输出我所在的当前页面(使用 PaginatorHelper)?
谢谢你!
I need the page number but cannot seem to find any documentation towards it. How do I output in my CakePHP view the current page I am on (using PaginatorHelper)?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
http://api.cakephp.org/class/paginator-helper#method-PaginatorHelpercurrent
http://api.cakephp.org/class/paginator-helper#method-PaginatorHelpercurrent
通过 pr() 提取 $this->request 后,我得到了这个解决方案
$currentPage = $this->request->paging['Model']['page']
并将其置于查看
$this->set('currentPage', $currentPage)
After extracted $this->request via pr(), I got this solution
$currentPage = $this->request->paging['Model']['page']
and to put it to view
$this->set('currentPage', $currentPage)