比如,我indexController里面的
indexAction,因为用户没有穿参数,我要重定向到 errorAction里面
$this->dispatcher->forward(array(
"controller" => "index",
"action" => "error",
"params" => array('step'=>2)
));
那么获取参数是:
$this->dispatcher->getParam('step')
本文介绍了一种在用户未提供必要参数时,通过代码将请求重定向到错误处理页面的方法。具体实现中使用了dispatcher组件来完成从当前控制器(indexController)的当前动作(indexAction)到另一个动作(errorAction)的跳转,并传递了一个名为'step'的参数。
比如,我indexController里面的
indexAction,因为用户没有穿参数,我要重定向到 errorAction里面
$this->dispatcher->forward(array(
"controller" => "index",
"action" => "error",
"params" => array('step'=>2)
));
那么获取参数是:
$this->dispatcher->getParam('step')
842

被折叠的 条评论
为什么被折叠?