<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國際加速解決方案。 廣告
                ## 后臺運行 借助 Swoole 讓 Mix 可以在代碼中實現原本 `nohup &` 的功能,讓守護進程能持續在后臺執行。 ## 用法 ``` use \Mix\Helper\ProcessHelper; ProcessHelper::daemon(bool $noclose = false, bool $nochdir = true) ``` ## 說明 由于 Swoole 4 所有協程必須在 Swoole\Coroutine\Scheduler 啟動,加上無法再協程中 Fork [#3005](https://github.com/swoole/swoole-src/issues/3005),因此用戶無法在 Command::class 等業務代碼中直接使用 `ProcessHelper::daemon` 實現后臺執行,根據以上限制條件 Fork 只能在 Scheduler 啟動之前執行,因此 Mix 通過在 `mix/console` >= v2.1.1 加入事件調度器調度 CommandBeforeExecuteEvent 事件,用戶可在 Scheduler 啟動之前執行 `ProcessHelper::daemon` 實現后臺執行。 ## CommandBeforeExecuteEvent 事件處理 首先我們創建一個 CommandListener::class 監聽器,用來監聽 CommandBeforeExecuteEvent 事件 [>> 查看 CommandListener::class 源碼 <<](https://github.com/mix-php/mix-skeleton/tree/v2.1/app/Common/Listeners/CommandListener.php) - CommandBeforeExecuteEvent 事件包含一個 command 的 string 類型屬性,值為當前執行的命令的類路徑 - 通過 switch case 可以選擇讓指定的 Command::class 執行 ProcessHelper::daemon() 然后我們需要在 [beans/event](https://github.com/mix-php/mix-skeleton/tree/v2.1/manifest/beans/event.php) 配置中將 CommandListener::class 監聽器注冊到 EventDispatcher::class 事件調度器中。
                  <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>

                              哎呀哎呀视频在线观看