PHP 5.6.0RC3 is available

Yaf_Controller_Abstract::forward

(Yaf >=1.0.0)

Yaf_Controller_Abstract::forwardfoward to another action

Descrierea

public void Yaf_Controller_Abstract::forward ( string $action [, array $paramters ] )
public void Yaf_Controller_Abstract::forward ( string $controller , string $action [, array $paramters ] )
public void Yaf_Controller_Abstract::forward ( string $module , string $controller , string $action [, array $paramters ] )

forward current execution process to other action.

Notă:

this method doesn't switch to the destination action immediately, it will take place after current flow finish.

Parametri

module

destination module name, if NULL was given, then default module name is assumed

controller

destination controller name

action

destination action name

paramters

calling arguments

Exemple

Example #1 Yaf_Controller_Abstract::forward()example

<?php
class IndexController extends Yaf_Controller_Abstract
{
    public function 
indexAction(){   
         
$logined $_SESSION["login"];
         if (!
$logined) {
             
$this->forward("login", array("from" => "Index")); // forward to login action
             
return FALSE;  // this is important, this finish current working flow
                            // and tell the Yaf do not doing auto-render
         
}

         
// other processes
    
}

    public function 
loginAction() {
         echo 
"login, redirected from "$this->_request->getParam("from") , " action";
    }
}
?>

Exemplul de mai sus va afișa ceva similar cu:

   login, redirected from Index action

Valorile întoarse

return FALSE on failure

Vedeți de asemenea

  • Yaf_Request_Abstrace::getParam()
add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top