phpzend-frameworkzend-authzend-acl

How to redirect to a different controller action in Zend


I am creating a simple website where users can sign up, and then sign in and add text articles. Without signing in, a visitor will have the role of a guest, and will only be able to view articles. I am doing this as an exercise in Zend framework 1, as I have just begun learning Zend. I will make a controller AuthController for login, but I want to know how do I redirect to the login action in that controller, from my indexAction in IndexController. Also, how do I make use of a custom plugin to implement this kind of access control? How do I invoke it?


Solution

  • You can redirect inside an action method using:

    $this->redirect('/module/controller/action/');