Yet Another Framework Yaf_Plugin_Abstract::routerShutdown
(Yaf >=1.0.0)
Yaf_Plugin_Abstract::routerShutdown — The routerShutdown purpose
설명
public Yaf_Plugin_Abstract::routerShutdown(Yaf_Request_Abstract $request
, Yaf_Response_Abstract $response
): void
이 후크는 라우트 프로세스가 완료된 후에 트리거되며 이 후크는 일반적으로 로그인 확인에 사용됩니다.
매개변수
request
response
반환 값
Examples
예제 #1 Yaf_Plugin_Abstract::routerShutdown() 예제
<?php
class UserInitPlugin extends Yaf_Plugin_Abstract {
public function routerShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {
$controller = $request->getControllerName();
/**
* Use access controller is unecessary for APIs
*/
if (in_array(strtolower($controller), array(
'api',
))) {
return TRUE;
}
if (Yaf_Session::getInstance()->has("login")) {
return TRUE;
}
/* Use access check failed, need to login */
$response->setRedirect("http://yourdomain.com/login/");
return FALSE;
}
}
?>
기타
- Yaf_Plugin_Abstract::routerStartup() - RouterStartup hook
- Yaf_Plugin_Abstract::dispatchLoopStartup() - Hook before dispatch loop
- Yaf_Plugin_Abstract::preDispatch() - The preDispatch purpose
- Yaf_Plugin_Abstract::postDispatch() - The postDispatch purpose
- Yaf_Plugin_Abstract::dispatchLoopShutdown() - The dispatchLoopShutdown purpose