Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/272.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CakePHP:Remove";第页:#;从url参数_Php_Forms_Cakephp_Parameters_Cakephp 2.3 - Fatal编程技术网

CakePHP:Remove";第页:#;从url参数

CakePHP:Remove";第页:#;从url参数,php,forms,cakephp,parameters,cakephp-2.3,Php,Forms,Cakephp,Parameters,Cakephp 2.3,我有一个使用get方法的搜索表单。该表单工作正常,直到我在对结果分页后使用它为止 用户可以从任意数量的URL进入网站,这些URL看起来像domain.com/serach/results/something/something\u else/重要的部分是domain.com/serach/results/ 下面是我的表单代码: echo $this->Form->create(null, array( 'type' => 'get', 'url' => $

我有一个使用
get
方法的搜索表单。该表单工作正常,直到我在对结果分页后使用它为止

用户可以从任意数量的URL进入网站,这些URL看起来像
domain.com/serach/results/something/something\u else/
重要的部分是
domain.com/serach/results/

下面是我的表单代码:

echo $this->Form->create(null, array(
    'type' => 'get',
    'url' => $this->Html->url(null, true),
));
<form action="http://domain.com/serach/results/something/something_else/page:3" method="get">
这将使表单如下所示:

<form action="http://domain.com/serach/results/something/something_else/" method="get">

问题是,当我对结果分页时,它会将第2页或第3页添加到操作中,因此看起来像:

echo $this->Form->create(null, array(
    'type' => 'get',
    'url' => $this->Html->url(null, true),
));
<form action="http://domain.com/serach/results/something/something_else/page:3" method="get">


CakePHP中是否有一个内置函数,允许我从传递给表单操作的url中删除
页面:3
,还是我必须创建一个函数来查找并删除
页面:

只需以详细的方式设置url即可:

'url' => array('controller' => 'x', 'action' => 'y') + $this->request->params['pass']

完成了

只需以详细的方式设置url即可:

'url' => array('controller' => 'x', 'action' => 'y') + $this->request->params['pass']

完成了

这样做wat不起作用,因为它在动作后失去了一切。因此,它导致了这个
domain.com/serach/results/
,而不是这个
domain.com/serach/results/something/something\u else/
。这样做wat不起作用,因为它在操作后失去了一切。因此它产生了这个
domain.com/serach/results/
,而不是这个
domain.com/serach/results/something/something\u else/