我在cakePHP 2.0中使用Js Pagination。我必须用cakePHP分页管理搜索结果。为此,我在控制器文件中设置了$ separator数组,并在ctp文件中传递
$this->Paginator->options(array('update' => '#mid_cont',
'url' => array('controller' => 'users', 'action' => 'index', "cond" => separator),
'before' => $this->Js->get("#loading")->effect('fadeIn'),
'success' => $this->Js->get("#loading")->effect('fadeOut'),
));
它在IE和Chrome中工作正常但在firefox中没有。在firefox中我得到$ this-> request-> params数组如下所示:
[plugin] =>
[controller] => users
[action] => index
[named] => Array
(
[cond%5Bgender%5D] => 'Male',
[cond%5Bage%5D] => '18',
)
它应该像下面的“输入代码”
[plugin] =>
[controller] => users
[action] => index
[named] => Array
(
[cond][gender] => 'Male',
[cond][age] => '18',
)
如果有人知道任何解决方案或与此问题相关的任何建议。请帮我。 在此先感谢.. :))
答案 0 :(得分:0)
对参数进行编码,应该没问题:
// writing
$this->params['named']['cond'] = base64_encode(json_encode($cond));
$this->params['named']['cond'] = strtr($this->params['named']['cond'], '+/=', '-_,');
// Reading
$cond = strtr($this->params['named']['cond'], '-_,', '+/=');
$cond = json_decode(base64_decode($cond), true);