dougan1465 2016-01-21 18:22
浏览 43
已采纳

CakePHP过滤器分页字段

In CakePHP v. 2.5.2, is there a simpler way to do this check?

if(!empty($this->passedArgs['somemodel.someatribute'])) {
    $paginate['conditions']['somemodel.someatribute'] = base64_decode($this->passedArgs['somemodel.someatribute']);
}

When I have many fields, the list will be very long and I would like to avoid that.

  • 写回答

1条回答 默认 最新

  • dqls67891 2016-01-21 18:40
    关注

    Can't you just use a standard foreach loop?

    foreach($this->passedArgs as $key => $value) {
        $paginate['conditions'][$key] = base64_decode($value);
    }
    

    Alternatively try looking into the $this->request->params['pass'] array, which is similar to $this->passedArgs.

    For further details, check out the CakePHP docs on routing.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?