2009-05-08 9 views
0

Quelle est la meilleure façon de gérer les actions non existantes dans Zend Framework?Gestion des actions non existantes?

En fonction du contrôleur, je veux pouvoir gérer la requête différemment.

BR Niklas

Répondre

2

Ajouter cette fonction à votre classe contrôleur

public function __call($method, $args){ 

    if ('Action' == substr($method, -6) && $method != 'indexAction') { 
     // If the action method was not found, forward to the index action 
     return $this->_forward('index'); 
    } 

    // all other methods throw an exception 
    throw new Exception('Invalid method "' . $method . '" called', 500); 
} 

Dans ce cas, les actions manquantes seront transmises à l'action index

Questions connexes