<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之旅 廣告
                ## beforeAction項目一開始加載先訪問這個方法 ![](https://img.kancloud.cn/09/f6/09f66369685d89c8d6e78e77c638fc07_672x298.png) ## 語法: 先繼承controller use think\Controller; class Index extends controller { } ## protected $beforeActionList=[] ## '自定義名稱', //所有方法訪問都先進入自定義名稱方法 ## '自定義名稱'=>['only'=>'index'], //只有index方法訪問才可以進自定義名稱方法 ## '自定義名稱'=>['except'=>'index'] //排除index,其他方法訪問可以訪問到自定義名稱 ![](https://img.kancloud.cn/cf/55/cf55f09f25f8d35c39250b7d381a8123_845x534.png) ## 語法應用 ``` protected $beforeActionList = [ 'allAction', //所有方法訪問都先進入allAction方法 'onlyAction'=>['only'=>'index'], //只有index方法訪問才可以進onlyActionfn方法 'exceptAction'=>['except'=>'index'] //排除index,其他方法訪問可以訪問到exceptAction ]; // 以下方法名稱必須對于以上屬性名稱 public function allAction(){ dump(' 輸出 allAction'); } public function onlyAction(){ dump('輸出 onlyAction'); } public function exceptAction(){ dump("輸出 exceptAction"); } ``` ![](https://img.kancloud.cn/64/20/6420f57c0769138d02be8893bcf30157_577x585.png) 代碼案例: ``` <?php namespace app\index\controller; use think\Controller; class Index extends controller { protected $beforeActionList = [ 'allAction', //所有方法訪問都先進入allAction方法 'onlyAction'=>['only'=>'index'], //只有index方法訪問才可以進onlyActionfn方法 'exceptAction'=>['except'=>'index'] //排除index,其他方法訪問可以訪問到exceptAction ]; public function index(){ dump( "輸出 index"); } public function allAction(){ dump(' 輸出 allAction'); } public function onlyAction(){ dump('輸出 onlyAction'); } public function text1(){ dump("輸出 text1"); } public function exceptAction(){ dump("輸出 exceptAction"); } } ```
                  <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>

                              哎呀哎呀视频在线观看