<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>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [TOC] # 簡介 中間件 中間件,在匹配路由之后,調取Controller之前執行(5.3下并不是,請查看下面控制器中間件描述 ),所以常用于用戶驗證、權限驗證等 中間件按照功能分為全局執行、路由執行 # 啟動文件 `/project_name/app/Http/Kernel.php` # 全局中間件 表示任何HTTP請求,都會執行這些中間件 ~~~ protected $middleware = [ \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, ]; ~~~ 系統會執行: `CheckForMaintenanceMode` ## Laravel 5.3 在Laravel 5.3中,將路由分為了:apiweb因此中間件也分成了兩部分 ~~~ protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ], 'api' => [ 'throttle:60,1', 'bindings', ], ]; ~~~ web路由 * EncryptCookies 加解密cookie * AddQueuedCookiesToResponse cookie自動添加到header,一般情況下用戶不用干預 * StartSession 開啟start_session() * ShareErrorsFromSession 從session讀取表單提交的歷史數據,便于取值old('field_name'),以及讀取錯誤 * VerifyCsrfToken 對每一個POST DELETE PUT請求的頁面,都會做Csrf 檢查, api路由 # 路由的中間件 只有當路由開啟本中間件時,方會調用。比如用戶驗證、權限驗證等操作 ~~~ protected $routeMiddleware = [ 'alias_name' => \App\Http\Middleware\XXXX::class ]; ~~~ 系統默認自帶這些 * auth ->Authenticate驗證用戶登錄 * auth.basic ->AuthenticateWithBasicAuth 基本的用戶登錄驗證 大家在登錄一些「FTP(網頁)、交換機、路由器」頁面時,會彈出一個系統的登錄框,便是這個 * guest ->RedirectIfAuthenticated 檢查訪客是否有已經有登錄態(如果保存了登錄態) ## 路由開啟中間件 ~~~ // 檢查登錄態,否則跳轉登錄 // auth 為 中間件 Authenticate 的別名 Route::group(['middleware' => 'auth']) ~~~ # 控制器中間件(5.3) 在每個Controller的構造函數中,也可以調用中間件 ~~~ class UserController extends Controller { public function __construct() { $this->middleware(['auth']); } } ~~~
                  <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>

                              哎呀哎呀视频在线观看