Yaf_Controller_Abstract::forward

(Yaf >=1.0.0)

Yaf_Controller_Abstract::forwardThe forward purpose

说锟斤拷

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

锟斤拷锟斤拷前锟斤拷锟斤拷锟斤拷转锟斤拷锟斤拷锟斤拷锟斤拷锟紸ction.

Note:

锟斤拷锟斤拷Yaf_Controller_Abstract::forward()锟皆猴拷, 锟斤拷锟斤拷直锟斤拷锟斤拷锟斤拷锟斤拷转锟斤拷目锟斤拷Action执锟斤拷, 锟斤拷锟角伙拷锟节碉拷前锟斤拷Action执锟斤拷锟斤拷珊锟�, 锟斤拷一锟街碉拷DispatchLoop锟斤拷, 锟斤拷锟斤拷目锟斤拷Action.

锟斤拷锟斤拷, 锟斤拷锟斤拷锟较o拷锟斤拷锟斤拷锟斤拷锟阶拷锟侥匡拷锟紸ction, 锟斤拷么锟斤拷使锟斤拷return锟斤拷锟斤拷锟斤拷前锟斤拷执锟斤拷锟斤拷锟斤拷.

锟斤拷锟斤拷

module

要锟斤拷转锟斤拷目锟斤拷Action锟斤拷Module, 锟斤拷锟斤拷锟絅ULL, 锟斤拷默锟斤拷Module锟结被锟斤拷锟斤拷.

controller

要锟斤拷转锟斤拷目锟斤拷Action锟斤拷Controller, 锟斤拷锟斤拷锟絅ULL, 锟斤拷默锟斤拷Controller锟结被锟斤拷锟斤拷.

action

要锟斤拷转锟斤拷目锟斤拷Action.

paramters

锟斤拷转锟斤拷锟斤拷, 锟斤拷锟斤拷锟斤拷目锟斤拷Action锟斤拷通锟斤拷Yaf_Request_Abstrace::getParam()锟斤拷锟斤拷取.

锟斤拷锟斤拷

Example #1 Yaf_Controller_Abstract::forward()锟斤拷锟斤拷

<?php
class IndexController extends Yaf_Controller_Abstract
{
    public function 
indexAction(){   
         
$logined $_SESSION["login"];
         if (!
$logined) {
             
$this->forward("login", array("from" => "Index")); // 锟斤拷转锟斤拷login Action
             
return FALSE;  // return锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷前锟斤拷执锟斤拷锟斤拷锟斤拷, 锟斤拷转锟斤拷目锟斤拷Action
                            // 锟斤拷锟斤拷锟斤拷锟紽ALSE锟角革拷锟斤拷Yaf锟斤拷要锟皆讹拷锟斤拷染锟斤拷锟紸ction锟斤拷锟斤拷图
         
}

         
// other processes
    
}

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

锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�

   login, redirected from Index action

锟斤拷锟斤拷值

return FALSE on failure

锟轿硷拷

  • Yaf_Request_Abstrace::getParam()