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

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## Swoole Swoole 本身提供了 [協程版本的 Client](https://wiki.swoole.com/wiki/page/p-coroutine_client.html),可進行 TCP 收發,與 PHP Socket 不同的是,Swoole Socket 支持設置協議,這樣就不需要手動解析協議了,因為高度封裝,所以 mix 就不封裝了,用戶可直接在 mix 中使用,下面是一個原生 DEMO。 - 將下面代碼保存為 `client.php`: > - 在 mix 使用時 `\Swoole\Coroutine\run` 用 `xgo` 代替 > - 其中 EOF 要與 TCP 服務器的 [StartCommand:class](https://github.com/mix-php/mix-skeleton/tree/v2.1/app/Tcp/Commands/StartCommand.php#L40) 中一至 ~~~ <?php const EOF = "\n"; \Swoole\Coroutine\run(function () { $client = new \Swoole\Coroutine\Client(SWOOLE_SOCK_TCP); $client->set([ 'open_eof_check' => true, 'package_eof' => EOF, ]); if (!$client->connect('127.0.0.1', 9503)) { throw new \Swoole\Exception($client->errMsg, $client->errCode); } $client->send('{"method":"foo.bar","params":[],"id":123}' . EOF); while (true) { $data = $client->recv(); if (!$data) { echo "disconnect, [{$client->errCode}] {$client->errMsg}" . PHP_EOL; break; } var_dump(json_decode($data, true)); } }); ~~~ **1. 啟動服務器** ~~~ php bin/mix.php tcp:start ~~~ **2. 執行 `client.php`** ~~~ php client.php ~~~ 接收到加入成功的消息: ~~~ [root@localhost data]# php client.php array(4) { ["jsonrpc"]=> string(3) "2.0" ["error"]=> NULL ["result"]=> array(1) { [0]=> string(13) "Hello, World!" } ["id"]=> int(123) } ~~~
                  <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>

                              哎呀哎呀视频在线观看