我的表格发出后,我得到:
http://... /param1/param2/CONTROLLER-NAME
如何摆脱网址的最后一部分 - CONTROLLER-NAME?
标准表单视图:
echo $this->Form->create('*',
array('url' => array('controller' => '*', 'action' => '*')
));
echo $this->Form->input('*', array('div' => false, 'empty' => true));
echo $this->Form->submit(__('Search', true), array('div' => false));
echo $this->Form->end();
答案 0 :(得分:2)
为什么在表单中使用'*'
?
通常,您的表单应如下所示:
echo $this->Form->create('Search', // model name, even if it doesn't really exists
array('url' => array('controller' => 'searches', 'action' => 'index')
));
echo $this->Form->input('search', array('div' => false, 'empty' => true));
echo $this->Form->submit(__('Search', true), array('div' => false));
echo $this->Form->end();
正常情况下,蛋糕正在创建这样的网址,通常生成的网址格式为/controller/action/params
,如果你想
希望这有帮助