<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國際加速解決方案。 廣告
                ## 安裝auth拓展 ``` composer require wenhainan/thinkphp6-auth ``` ## Auth配置文件 ![](https://img.kancloud.cn/87/6c/876cdb080b2d898648d8c7bf0ade99ed_933x294.png) ## 創建權限檢查中間件 ``` php think make:middleware CheckAuth ``` ## 配置中間件別名 ![](https://img.kancloud.cn/81/4c/814c7bdf4dd79bceb7814353ce088054_1290x430.png) ## 在需要驗證權限的控制器類中調用該中間件 ``` protected $middleware = ['auth']; ``` ## 權限處理中間件 ``` <?php declare (strict_types = 1); namespace app\middleware; use think\facade\Session; use think\wenhainan\Auth; //引入Auth類 use app\BaseController; use liliuwei\think\Jump; /** * 權限處理中間件 */ class CheckAuth extends BaseController { use Jump; /** * 處理請求 */ public function handle($request, \Closure $next) { // 調用權限檢查方法 $this->checkAuth(); return $next($request); } /** * 權限檢查 * @return bool */ function checkAuth() { //已登錄用戶id $id=session('id'); if (!$id) { $this->redirect('/admin/login'); } $module = request()->root(); //應用名 $controller = request()->controller(); //控制器名 $action = request()->action(); //方法名 // 請求到的規則名 AuthRule Name $url=$module . '/' . $controller . '/' . $action; //實例化Auth $auth = new Auth(); if (!$auth->check( $url , $id ) ) { // 沒有權限跳轉到未授權頁面 $this->success("當前用戶沒有該操作權限,請聯系管理員!",'../'); } } } ```
                  <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>

                              哎呀哎呀视频在线观看