在没有模板的情况下在Zend Framework 2中进行重定向

Vad*_*aev 2 php redirect templates zend-framework2

我正在尝试从route/admin重定向到/ admin/post/list.

我设置了从/ admin到IndexController :: indexAction()的路由

然后我像这样做了控制器

class IndexController extends AbstractActionController
{
    public function indexAction()
    {
        $this->redirect()->toRoute('postList');
    }
}
Run Code Online (Sandbox Code Playgroud)

它运行良好,但ZF2需要制作模板index/index.phtml.

如何在没有空模板的情况下更好地重定向?

DrB*_*eza 6

如果添加return它应该工作:

return this->redirect()->toRoute('postList');
Run Code Online (Sandbox Code Playgroud)