【问题标题】:Grabbing the page number in the controller in CakePHP在 CakePHP 的控制器中抓取页码
【发布时间】:2012-08-09 05:05:44
【问题描述】:

如何在我的 php 代码的控制器中获取页码并设置它?

【问题讨论】:

    标签: cakephp cakephp-2.0 cakephp-2.1


    【解决方案1】:

    当前页码将在控制器params中。

    尝试调试它以查看其内容,或使用DebugKit

    // Within your controller action:
    debug($this->request->params);
    

    【讨论】:

    • 是的,我正在用这个 print_r($this->request->params) 看那里,但看不到页面,但 $this->paginator->current 输出 1. 1 在哪里?
    • 我找到了:$this->request->params['named']['page'];
    【解决方案2】:

    以下为您提供cakephp 2 中的页码

    $this->request->params['named']['page']
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-08
      • 2011-12-02
      • 2015-01-20
      • 2016-12-25
      • 2013-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多