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

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # swoole_http_response->detach 分離響應對象。使用此方法后,`$response`對象銷毀時不會自動`end`,與`swoole_http_response::create`和`Server::send`配合使用。 ```php function swoole_http_response->detach(); ``` * 客戶端已完成響應,操作失敗返回`false`,成功返回`true` > 需要`2.2.0`或更高版本 跨進程響應 ---- 某些情況下,需要在`Task`進程中對客戶端發出響應。這時可以利用`detach`使`$response`對象獨立。在`Task`進程可以重新構建`$response`,發起`Http`請求響應。 ```php $http = new swoole_http_server("0.0.0.0", 9501); $http->set(['task_worker_num' => 1, 'worker_num' => 1]); $http->on('request', function ($req, Swoole\Http\Response $resp) use ($http) { $resp->detach(); $http->task(strval($resp->fd)); }); $http->on('finish', function () { echo "task finish"; }); $http->on('task', function ($serv, $task_id, $worker_id, $data) { var_dump($data); $resp = Swoole\Http\Response::create($data); $resp->end("in task"); echo "async task\n"; }); $http->start(); ``` 發送任意內容 ---- 某些特殊的場景下,需要對客戶端發送特殊的響應內容。`Http\Response`對象自帶的`end`方法無法滿足需求,可以使用`detach`分離響應對象,然后自行組包并使用`Server::send`發送數據。 ```php $http = new swoole_http_server("0.0.0.0", 9501); $http->on('request', function ($req, Swoole\Http\Response $resp) use ($http) { $resp->detach(); $http->send($resp->fd, "HTTP/1.1 200 OK\r\nServer: server\r\n\r\nHello World\n"); }); $http->start(); ```
                  <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>

                              哎呀哎呀视频在线观看