beebe_3 发表于 2017-9-7 12:14:02

Herosphp 3.0.1 发布,轻量级php开源框架

class DefaultWebappListener extends WebApplicationListenerMatcher implements IWebAplicationListener {  

  
   /**
  
      * 请求初始化之前
  
      * @return mixed
  
      */
  
   public function beforeRequestInit()
  
   {
  
         //设置跳过监听的uri, 比如登录页面,注册页面等
  
         $this->skipUrl("/user/**"); //跳过用户模块下所有请求
  
         $this->skipUrl("/admin/login/**"); //跳过登录控制器所有请求
  
         $this->skipUrl("/admin/scode/index"); //跳过验证码请求
  

  
         // TODO: Implement beforeRequestInit() method.
  
   }
  

  
   /**
  
      * action 方法调用之前
  
      * @return mixed
  
      */
  
   public function beforeActionInvoke(HttpRequest $request)
  
   {
  
      echo "捕获请求";
  
   }
  

  
   /**
  
      * 响应发送之前
  
      * @return mixed
  
      */
  
   public function beforeSendResponse(HttpRequest $request, $actionInstance)
  
   {
  
         $webApp = WebApplication::getInstance();
  
         //注册当前app的配置信息
  
         $actionInstance->assign('appConfigs', $webApp->getConfigs());
  
         $actionInstance->assign('params', $webApp->getHttpRequest()->getParameters());
  
   }
  

  
   /**
  
      * 响应发送之后
  
      * @return mixed
  
      */
  
   public function afterSendResponse($actionInstance)
  
   {
  
         // TODO: Implement afterSendResponse() method.
  
   }
  

  
}

l4537459 发表于 2018-6-7 09:19:48

好东西,赞一个
页: [1]
查看完整版本: Herosphp 3.0.1 发布,轻量级php开源框架