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

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ## Facade Facade為容器中的類提供了一個靜態調用接口,相比于傳統的靜態方法, 帶來了更好的可測試性和擴展性,你可以為任何的非靜態類庫定義一個facade類。 ~~~ <?php namespace app\common; class Test { public function hello($name) { return 'hello,' . $name; } } ~~~ ~~~ <?php namespace app\facade; use think\Facade; class Test extends Facade { protected static function getFacadeClass() { return 'app\common\Build'; } } ~~~ 只需要定義一個facade類庫并且繼承`think\Facade`,就可以使用靜態方式調用Test類的動態方法,例如: ~~~ use app\facade\Test; Test::hello('thinkphp'); ~~~ 就會輸出 `hello,thinkphp`。 如果沒有通過`getFacadeClass`方法顯式指定代理類庫,可以在調用的時候進行動態綁定: ~~~ <?php namespace app\facade; use think\Facade; class Test extends Facade { } ~~~ ~~~ use app\facade\Test; use think\Facade; Facade::bind('app\facade\Test','app\common\Test'); Test::hello('thinkphp'); ~~~ 系統給內置的常用類庫定義了Facade類庫,包括: |類庫|Facade| |---|---| | think\App | think\facade\App| | think\Cache | think\facade\Cache| | think\Config | think\facade\Config| | think\Cookie | think\facade\Cookie| | think\Debug | think\facade\Debug | | think\Env | think\facade\Env | | think\Hook | think\facade\Hook| | think\Lang | think\facade\Lang| | think\Log | think\facade\Log | | think\Request | think\facade\Request | | think\Response | think\facade\Reponse| | think\Route | think\facade\Route | | think\Session | think\facade\Session| | think\Url | think\facade\Url | | think\View | think\facade\View | 所以你無需進行實例化就可以很方便的進行方法調用,例如: ~~~ use think\facade\App; App::version(); App::getThinkPath(); // 或者使用助手函數 app()->version(); app()->getThinkPath(); ~~~ 當app助手函數參數為空的時候,表示獲取`think\App`對象實例。 App類是一個特殊的容器助手,可以通過app助手函數方便的操作容器,綁定對象實例 ~~~ app()->test = new Test; app()['test'] = new Test; ~~~ 獲取容器中的對象實例下面用法是等效的: ~~~ app()->test; app()['test']; ~~~
                  <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>

                              哎呀哎呀视频在线观看