<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 功能強大 支持多語言、二開方便! 廣告
                ## 依賴注入 # 了解依賴注入 *依賴注入*和*依賴注入容器*是不同的東西: * **依賴注入是一種**編寫更好代碼的方法 * **容器是**幫助注入依賴項的工具 您*不需要*容器來進行依賴注入。但是,容器可以幫助您。 PHP-DI 就是這樣:使依賴注入更實用。 ## 理論[#](https://php-di.org/doc/understanding-di.html#the-theory) ### 經典的 PHP 代碼[#](https://php-di.org/doc/understanding-di.html#classic-php-code) 以下是**不**使用 DI 的代碼大致如何工作: * 應用程序需要 Foo(例如控制器),所以: * 應用程序創建 Foo * 應用程序調用 Foo * Foo 需要 Bar(例如服務),所以: * Foo 創建 Bar * Foo 呼叫 Bar * Bar 需要 Bim(服務、存儲庫……),所以: * Bar 創建 Bim * 酒吧做點什么 ### 使用依賴注入[#](https://php-di.org/doc/understanding-di.html#using-dependency-injection) 以下是使用 DI 的代碼大致如何工作: * 應用需要Foo,需要Bar,需要Bim,所以: * 應用程序創建 Bim * 應用程序創建 Bar 并為其提供 Bim * 應用程序創建 Foo 并給它 Bar * 應用程序調用 Foo * Foo 呼叫 Bar * 酒吧做點什么 這就是**控制反轉**的模式。依賴關系的控制從一個被調用**反**轉到一個調用。 https://php-di.org/doc/understanding-di.html [依賴自動注入 - webman](https://www.workerman.net/doc/webman/di.html#%E4%BE%9D%E8%B5%96%E8%87%AA%E5%8A%A8%E6%B3%A8%E5%85%A5)
                  <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>

                              哎呀哎呀视频在线观看