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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ## 說明 實現登錄控制與權限控制分別是下面兩個中間件負責: Login 負責登錄 ~~~ \app\index\middleware\Login::class ~~~ Auth 負責權限控制 ~~~ \app\index\middleware\Auth::class ~~~ ## 登錄限制 在需要限制的控制器增加`$middleware`屬性,例如下面的`Demo`控制器 ~~~ <?php namespace app\index\controller; class Demo extends BaseController { protected $middleware = [ // 增加權限控制屬性,整個控制器將需要登錄 \app\index\middleware\Login::class ]; } ~~~ 只限制特定方法需要登錄,其他方法不需要登錄可以使用下面兩個參數 1. only 限制部分方法生效,如下示例(限制index,show方法需要登錄) ~~~ <?php namespace app\index\controller; class Demo extends BaseController { protected $middleware = [ // 限制index,show方法需要登錄 \app\index\middleware\Login::class=> ['only'=>['index','show']] ]; public function index() { echo 1; } public function show() { echo 2; } public function lists() { echo 2; } } ~~~ 2. except 排除部分方法,其他方法生效,示例 ~~~ <?php namespace app\index\controller; class Demo extends BaseController { protected $middleware = [ // index方法不需要登錄,其他的方法需要登錄 \app\index\middleware\Login::class=> ['except'=>['index']] ]; public function index() { echo 1; } public function show() { echo 2; } public function lists() { echo 2; } } ~~~ ## 權限控制 `$middleware`屬性里面寫入如下格式 ~~~ <?php namespace app\index\controller; class Demo extends BaseController { protected $middleware = [ \app\index\middleware\Login::class, \app\index\middleware\Auth::class // 限制權限 ]; public function index() { echo 1; } public function show() { echo 2; } } ~~~ 權限控制也支持only、except來限制部分方法生效,使用方式同登錄限制一致。
                  <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>

                              哎呀哎呀视频在线观看