<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之旅 廣告
                ## 控制前前置與后置操作 ### 1、基礎控制器修改 因為執行控制器的`callAction`操作,所以可以在繼承控制器中改寫`callAction`方法 這個方法只適合指定操作控制器的路由,萬能路由則不適合此方法 ~~~ /** * 改寫父級控制器中的 callAction 用于構建前置與后置操作方法【失敗】 */ public function callAction($method, $parameters) { $before = '_before_'.$method; $after = '_after_'.$method; // 前置操作 if(method_exists($this, $before)){ $this->{$before}(...array_values($parameters)); } $result = $this->{$method}(...array_values($parameters)); // 后置操作 if(method_exists($this, $after)){ $this->{$after}(...array_values($parameters)); } return $result; } ~~~ ### 2、萬能路由使用 ~~~ Route::group( ['prefix' => 'business'], function() { Route::any( "/{controller}/{action}", function($class, $action) { // 為了配合萬能路由 有些駝峰式的控制器采用別名操作 $alias = [ 'classesmember' => 'ClassesMember', 'businessmember' => 'BusinessMember', 'signorgan' => 'SignOrgan', 'signaddress' => 'SignAddress', 'signset' => 'SignSet', 'businessfence' => 'BusinessFence', ]; if(isset($alias[$class])){ $class = $alias[$class]; } // 獲取控制器 執行操作 $class = "App\\Http\\Controllers\\Business\\".ucfirst($class).'Controller'; $result = ['code' => 400, 'msg' => '操作文件不存在!',]; if(class_exists($class)){ $controller = \App::make($class); if(method_exists($controller, $action)){ // 前置 后置方法 $before_action = '_prefix_'.$action; // _before_ 已經使用 $after_action = '_after_'.$action; // 前置操作 if(method_exists($controller, $before_action)){ \App::call([$controller, $before_action]); } // 執行控制器 $result = \App::call([$controller, $action]); // 后置操作 if(method_exists($controller, $after_action)){ \App::call([$controller, $after_action]); } } else{ $result = ['code' => 400, 'msg' => '操作方法不存在!',]; } } return $result; } )->where(['module' => '[0-9a-zA-Z]+', 'class' => '[0-9a-zA-Z]+', 'action' => '[0-9a-zA-Z]+']); } ); ~~~
                  <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>

                              哎呀哎呀视频在线观看