(Yaf >=1.0.0)
Yaf_Controller_Abstract::forward — The forward purpose
$module
[, string $controller
[, string $action
[, array $paramters
]]] ) : void����ǰ������ת���������Action.
Note:
����Yaf_Controller_Abstract::forward()�Ժ�, ����ֱ��������ת��Ŀ��Actionִ��, ���ǻ��ڵ�ǰ��Actionִ����ɺ�, ��һ�ֵ�DispatchLoop��, ����Ŀ��Action.
����, �����ϣ��������ת��Ŀ��Action, ��ô��ʹ��return������ǰ��ִ������.
module
Ҫ��ת��Ŀ��Action��Module, �����NULL, ��Ĭ��Module�ᱻ����.
controller
Ҫ��ת��Ŀ��Action��Controller, �����NULL, ��Ĭ��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
// �������FALSE�Ǹ���Yaf��Ҫ�Զ���Ⱦ���Action����ͼ
}
// other processes
}
public function loginAction() {
echo "login, redirected from ", $this->_request->getParam("from") , " action";
}
}
?>
�������̵���������ڣ�
login, redirected from Index action
return FALSE on failure