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

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 控制器中間件 `V5.1.17+`版本開始,支持為控制器定義中間件。首先你的控制器需要繼承系統的`think\Controller`類,然后在控制器中定義`middleware`屬性,例如: ~~~ <?php namespace app\index\controller; use think\Controller; class Index extends Controller { protected $middleware = ['Auth']; public function index() { return 'index'; } public function hello() { return 'hello'; } } ~~~ 當執行`index`控制器的時候就會調用`Auth`中間件,一樣支持使用完整的命名空間定義。 如果需要設置控制器中間的生效操作,可以如下定義: ~~~ <?php namespace app\index\controller; use think\Controller; class Index extends Controller { protected $middleware = [ 'Auth' => ['except' => ['hello'] ], 'Hello' => ['only' => ['hello'] ], ]; public function index() { return 'index'; } public function hello() { return 'hello'; } } ~~~ ## 控制器傳參 可以通過給請求對象賦值的方式傳參給控制器(或者其它地方),例如 ~~~ <?php namespace app\http\middleware; class Hello { public function handle($request, \Closure $next) { $request->hello = 'ThinkPHP'; return $next($request); } } ~~~ > 注意,傳遞的變量名稱不要和`param`變量有沖突。 然后在控制器的方法里面可以直接使用 ~~~ public function index(Request $request) { return $request->hello; // ThinkPHP } ~~~
                  <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>

                              哎呀哎呀视频在线观看