We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Whether the "Dispatcher->forward" support module or not?

i have a scope code like these

//默认配置(the default config)
$this->options = is_null($options)?array(
            'forward' => array(
                'module' => 'content',
                'controller' => 'index',
                'action' => 'index',
            )
        ):$options;

//出错时跳转为,目的是针对不同的模块,因权限的不同跳转到默认页面也不同(if error,it will show me the default page)
$dispatcher->forward($this->options['forward']);

现在发现的问题是,这里的forward不支持 module 参数,仅支持 controller & action,请问,你们是怎么解决这个问题的?

but now ,i found the function called forward cant support this method,so please,have you troubled with this problem?or will you have a good way to solve this problem,thanks!

Yunlong Thanks



98.9k

No, forward only works in the same module, you can use redirections there.

return $this->response->redirect('/path');