2012-09-20 34 views
0

我开始使用Zend框架和MVC更为广泛,我不能管理重定向的情况下,他已经进入的形式的东西,用户...如何重定向到一个特定的视图控制器

<?php 

class adresseController extends Zend_Controller_Action { 

    public function init() { 
    global $config; 

    $protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"], 0, 5)) == 'https' ? "https://" : "http://"; 
    $this->view->url = $protocol . $config->app->url; 
    } 

    public function adresseAction() { 
    //Si la méthode isPost() de l'objet de requête renvoie true, alors le formulaire a été envoyé. 
    if ($this->getRequest()->isPost()) { 
     //récupération des données 
     $prenom = $form->getValue('prenom'); 
     if($prenom == "arnaud") 
     { 
     $this->_helper->redirector("inscription/index"); 
     } 
    } 

} 
} 
?> 

场的问题在我的HTML表单:

<div><input type="text" name="prenom" value="" title="Pr&#233;nom *" class="small error"/> 

题词/索引是我想被重定向到视图的名称。

在此先感谢您的帮助

回答

2

如果你想重定向到URL,然后使用此:

$this->_redirect("/inscription/index"); 

如果你想重定向到控制器,那么你已经在使用:

$this->_helper->redirector('action', 'controller'); 
相关问题