(Yaf >=1.0.0)
Yaf_Plugin_Abstract::routerShutdown — The routerShutdown purpose
$request
, Yaf_Response_Abstract $response
) : void锟斤拷锟斤拷锟斤拷锟斤拷锟铰凤拷山锟斤拷锟街拷蟠シ锟斤拷锟酵拷锟斤拷锟斤拷锟斤拷诘锟铰斤拷锟介。
锟斤拷锟斤拷锟斤拷锟斤拷未锟斤拷写锟侥碉拷锟斤拷锟斤拷锟叫诧拷锟斤拷锟叫憋拷
request
response
Example #1 Yaf_Plugin_Abstract::routerShutdown()example
<?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->redirect("http://yourdomain.com/login/");
return FALSE;
}
?>