0
$this->paginate = array(
     'limit' => 5,
     'conditions' => ''
);


$this->paginate['conditions'] = array(
     'name LIKE' => '%a'
);

他们注意到:

Notice (8): Indirect modification of overloaded property EmployeeCvsController::$paginate has no effect [APP\Controller\EmployeeCvsController.php, line 137]

有人可以解释一下为什么我不能从数组中更改订单元素吗?

4

1 回答 1

2

根据这本书,你可以

1)$paginate在控制器中指定变量(而不是在动作中):

public $paginate = array();

或 2) 只需将其放入一个数组而不是两个数组中:

    $this->paginate = array(
         'limit' => 5,
         'conditions' => array(
            'name LIKE' => '%a'
         )
    );

或 3)在第二个参考上使用$paginate而不是:$this->paginate

$paginate['conditions'] = array(
   'name LIKE' => '%a'
);
于 2012-08-27T12:41:18.267 回答