<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## 中間件 中間件主要用于攔截或過濾應用的請求,并進行必要的業務處理,通常使用在登錄驗證的場景。 ## 定義中間件 源碼中默認自帶了兩個中間件,一個前置,一個后置。 >[success] - 中間件類名必須帶 Middleware 后綴 ### 前置中間件 如果想攔截請求不往下執行,只需在 $next() 前 return 響應內容即可。 [>> 到 GitHub 查看范例 <<](https://github.com/mix-php/mix/blob/v2/applications/http/src/Middleware/BeforeMiddleware.php) ### 后置中間件 [>> 到 GitHub 查看范例 <<](https://github.com/mix-php/mix/blob/v2/applications/http/src/Middleware/AfterMiddleware.php) ## 注冊中間件 ### 全局中間件 [路由組件配置](https://github.com/mix-php/mix/blob/v2/applications/http/config/main_coroutine.php#L144) 中的 `middleware` 配置項目可配置全局中間件,全局中間件是全局有效的,對任何路由都有效。 ~~~ // 全局中間件 'middleware' => ['After'], ~~~ >[info] 配置時不需要加 Middleware 后綴。 ### 路由中間件 我們也可以在路由中為某一個路由規則配置要執行的中件間,如下: ~~~ // 路由規則 'rules' => [ // 一級路由 '/{controller}/{action}' => ['{controller}', '{action}', 'middleware' => ['Before']], ], ~~~ ### 如果我們需要排除某些路由規則不使用中間件 只需要在 **帶通配符規則的前面** 增加一條不帶 middleware 配置的路由。 ~~~ // 路由規則 'rules' => [ // 一級路由中URL /profile/userinfo 不使用中間件 '/profile/userinfo' => ['Profile', 'Userinfo'], // 一級路由 '/{controller}/{action}' => ['{controller}', '{action}', 'middleware' => ['Before']], ], ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看