©
This document uses PHP Chinese website manual Release
(Yaf >=1.0.0)
Yaf_Plugin_Abstract::routerShutdown — The routerShutdown purpose
$request
, Yaf_Response_Abstract $response
)这个钩子在路由结束之后触发,通常被用于登陆检查。
本函数还未编写文档,仅有参数列表。
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 ();
if ( in_array ( strtolower ( $controller ), array(
'api' ,
))) {
return TRUE ;
}
if ( Yaf_Session :: getInstance ()-> has ( "login" )) {
return TRUE ;
}
$response -> redirect ( "http://yourdomain.com/login/" );
return FALSE ;
}
?>