Yet Another Framework Yaf_Controller_Abstract::forward
(Yaf >=1.0.0)
Yaf_Controller_Abstract::forward — Forward to another action
설명
public Yaf_Controller_Abstract::forward(string $action
, array $paramters
= ?): bool
public Yaf_Controller_Abstract::forward(string $controller
, string $action
, array $paramters
= ?): bool
public Yaf_Controller_Abstract::forward( string $module, string $controller, string $action, array $paramters = ? ): bool
현재 실행 프로세스를 다른 작업으로 전달합니다.
메모: 이 메서드는 대상 작업으로 즉시 전환되지 않으며 현재 흐름이 완료된 후에 발생합니다.
매개변수
module
- 대상 모듈 이름, NULL이 제공된 경우 기본 모듈 이름이 가정됩니다.
controller
- 대상 컨트롤러 이름
action
- 대상 작업 이름
paramters
- 호출 인수
반환 값
성공하면 true
를, 실패하면 false
를 반환합니다.
Examples
예제 #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")); // 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";
}
}
?>
위의 예는 다음과 유사한 결과를 출력합니다.
login, redirected from Index action
기타
- Yaf_Request_Abstrace::getParam()