Skip to content
zuowenjian@ayb edited this page Jun 22, 2016 · 1 revision

拦截器

接口

abstract class XInterceptor
{
    public function _before($xcontext,$request,$response) {}
    public function _after($xcontext,$request,$response) {}
    public function _exception($e,$xcontext,$request,$response) {}
}

拦截器调用原理

$itc = getInterceptor() ;
try {
    $itc->_before() ;
    some_service();
}
catch(Exception $e) {
    $itc->_exception() ;
}
$itc->_after() ;
Clone this wiki locally