zend-framework - Zend 框架路由/重定向

标签 zend-framework

我试图在用户注册后将其重定向到注册页面,但它没有这样做..

<?php

class RegisterController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        $form = new Application_Form_Register();
        $form->submit->setLabel('Register');
        $this->view->form = $form;
        if ($this->getRequest()->isPost()) {
            $formData = $this->getRequest()->getPost();
            if ($form->isValid($formData)) {
                $first_name = $form->getValue('first_name');
                $surname = $form->getValue('surname');
                $email = $form->getValue('email');
                $username = $form->getValue('username');
                $password = $form->getValue('password');
                $is_admin = $form->getValue('is_admin');
                $age = $form->getValue('age');
                $gender = $form->getValue('gender');
                $uni = $form->getValue('uni');
                $register = new Application_Model_DbTable_Users();
                $register->addUser($first_name, $surname, $email, $username, $password, $is_admin, $age, $gender, $uni);

            } else {
                $form->populate($formData);
            }
            $route = array('controller'=>'Register', 'action'=>'registered');
                    $this->_helper->redirector->gotoRoute($route);

        }
    }

    public function registeredAction()
    {
        // action body
    }

}

这就是我所拥有的

谢谢

最佳答案

在 Controller 中您可以执行以下操作:

$this->_redirect('/controller/action');

关于zend-framework - Zend 框架路由/重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10435981/

相关文章:

php - Zend Framework 多数据库

php - 将Google Analytics(分析)数据API连接到Dojo图表-PHP后端

php - 如何使用 ZF 在身份验证适配器中添加凭据列

javascript - 使用 zend 框架更新 body 标签中的 javascript

zend-framework - 使用 Doctrine 2 和 Repositories,服务层的目的是什么?

zend-framework - 如何在Zend Framework 1.11项目中实现Varnish

zend-framework - 如何在zend框架中访问 Controller 名称和 Action 名称表单布局文件

php - 如何使用 zend paginate 和普通的 sql 查询而不是 zend_db_select

php - 如何使用 PHP 摘要?

zend-framework - Magento 自定义模块(它们是什么以及谁可以编写它们)