<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之旅 廣告
                ~~~ <?php function middleware($handlers,$arguments = []){ //函數棧 $stack = []; $result = null; foreach ($handlers as $handler) { // 每次循環之前重置,只能保存最后一個處理程序的返回值 $result = null; $generator = call_user_func_array($handler, $arguments); if ($generator instanceof \Generator) { //將協程函數入棧,為重入做準備 $stack[] = $generator; //獲取協程返回參數 $yieldValue = $generator->current(); //檢查是否重入函數棧 if ($yieldValue === false) { break; } } elseif ($generator !== null) { //重入協程參數 $result = $generator; } } $return = ($result !== null); //將協程函數出棧 while ($generator = array_pop($stack)) { if ($return) { $generator->send($result); } else { $generator->next(); } } } $abc = function(){ echo "this is abc start \n"; yield; echo "this is abc end \n"; }; $qwe = function (){ echo "this is qwe start \n"; $a = yield; echo $a."\n"; echo "this is qwe end \n"; }; $one = function (){ return 1; }; middleware([$abc,$qwe,$one]); /* * output * * this is abc start * this is qwe start * 1 * this is qwe end * this is abc end */ ~~~ 通過middleware()方法我們就實現了一個這樣的效果 ~~~ (begin) ----------------> function() -----------------> (end) ^ ^ ^ ^ ^ ^ | | | | | | | | +------- M1() ------+ | | | +----------- ... ----------+ | +--------------- Mn() --------------+ ~~~~
                  <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>

                              哎呀哎呀视频在线观看