{"id":1078,"date":"2025-01-19T13:54:31","date_gmt":"2025-01-19T05:54:31","guid":{"rendered":"https:\/\/www.laixuexila.com\/?p=1078"},"modified":"2025-01-20T23:02:11","modified_gmt":"2025-01-20T15:02:11","slug":"swoole-%e5%ae%9e%e6%88%98%e9%a1%b9%e7%9b%ae%e6%a1%88%e4%be%8b%ef%bc%9a%e6%9e%84%e5%bb%ba%e9%ab%98%e5%b9%b6%e5%8f%91%e5%ae%9e%e6%97%b6%e5%ba%94%e7%94%a8%e4%b8%8e%e9%ab%98%e6%95%88%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/www.laixuexila.com\/index.php\/2025\/01\/19\/swoole-%e5%ae%9e%e6%88%98%e9%a1%b9%e7%9b%ae%e6%a1%88%e4%be%8b%ef%bc%9a%e6%9e%84%e5%bb%ba%e9%ab%98%e5%b9%b6%e5%8f%91%e5%ae%9e%e6%97%b6%e5%ba%94%e7%94%a8%e4%b8%8e%e9%ab%98%e6%95%88%e6%9c%8d%e5%8a%a1\/","title":{"rendered":"swoole \u5b9e\u6218\u9879\u76ee\u6848\u4f8b\uff1a\u6784\u5efa\u9ad8\u5e76\u53d1\u5b9e\u65f6\u5e94\u7528\u4e0e\u9ad8\u6548\u670d\u52a1"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Swoole \u63d0\u4f9b\u4e86\u9ad8\u6027\u80fd\u7684\u534f\u7a0b\u548c\u591a\u8fdb\u7a0b\u6a21\u578b\uff0c\u9002\u7528\u4e8e\u9700\u8981\u5904\u7406\u5927\u91cf\u5e76\u53d1\u8bf7\u6c42\u3001\u957f\u8fde\u63a5\u3001\u9ad8\u541e\u5410\u91cf\u7b49\u573a\u666f\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u57fa\u4e8e Swoole \u7684\u5b9e\u6218\u9879\u76ee\u793a\u4f8b\uff0c\u901a\u8fc7\u8fd9\u4e9b\u9879\u76ee\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u6df1\u5165\u7406\u89e3 Swoole \u7684\u4f7f\u7528\u548c\u4f18\u5316\u6280\u5de7\u3002<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">1. <strong>\u9ad8\u6027\u80fd Web \u670d\u52a1\u5668<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Swoole \u662f\u4e00\u4e2a\u6781\u5176\u9002\u5408\u7528\u6765\u5f00\u53d1\u9ad8\u6027\u80fd Web \u670d\u52a1\u5668\u7684\u5de5\u5177\uff0c\u5c24\u5176\u662f\u5728\u5904\u7406\u5927\u91cf\u5e76\u53d1\u8bf7\u6c42\u65f6\uff0c\u80fd\u591f\u663e\u8457\u63d0\u5347\u6027\u80fd\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u57fa\u4e8e Swoole \u5b9e\u73b0\u7684 Web \u670d\u52a1\u5668\u7684\u7b80\u5355\u793a\u4f8b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1.1 <strong>\u9879\u76ee\u80cc\u666f<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u76ee\u6807\u662f\u4f7f\u7528 Swoole \u6765\u642d\u5efa\u4e00\u4e2a\u7b80\u5355\u7684 HTTP \u670d\u52a1\u5668\uff0c\u5904\u7406\u5927\u91cf\u7684\u5e76\u53d1\u8bf7\u6c42\uff0c\u652f\u6301\u9759\u6001\u6587\u4ef6\u670d\u52a1\u548c\u52a8\u6001\u8bf7\u6c42\u7684\u5904\u7406\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1.2 <strong>\u6b65\u9aa4<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u5b89\u88c5 Swoole \u6269\u5c55<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u9996\u5148\u9700\u8981\u5b89\u88c5 Swoole \u6269\u5c55\u5305\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 Composer \u5b89\u88c5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>composer require swoole\/swoole<\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u521b\u5efa HTTP \u670d\u52a1\u5668<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\/\/ http-server.php\n\n\/\/ \u521b\u5efa Swoole HTTP \u670d\u52a1\u5668\n$http = new Swoole\\Http\\Server(\"127.0.0.1\", 9501);\n\n\/\/ \u8bbe\u7f6e\u670d\u52a1\u5668\u914d\u7f6e\n$http-&gt;set(&#91;\n    'worker_num' =&gt; 4,  \/\/ \u8bbe\u7f6e\u5de5\u4f5c\u8fdb\u7a0b\u6570\n    'daemonize' =&gt; true, \/\/ \u540e\u53f0\u8fd0\u884c\n]);\n\n\/\/ \u5b9a\u4e49\u8bf7\u6c42\u5904\u7406\u56de\u8c03\n$http-&gt;on(\"request\", function ($request, $response) {\n    \/\/ \u5904\u7406\u52a8\u6001\u8bf7\u6c42\n    if ($request-&gt;server&#91;'request_uri'] === '\/hello') {\n        $response-&gt;end(\"Hello, Swoole!\");\n    } else {\n        \/\/ \u5904\u7406\u9759\u6001\u6587\u4ef6\n        $file = __DIR__ . $request-&gt;server&#91;'request_uri'];\n        if (file_exists($file)) {\n            $response-&gt;sendfile($file);\n        } else {\n            $response-&gt;status(404);\n            $response-&gt;end(\"Page not found\");\n        }\n    }\n});\n\n\/\/ \u542f\u52a8\u670d\u52a1\u5668\n$http-&gt;start();<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>\u8fd0\u884c\u670d\u52a1\u5668<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>php http-server.php<\/code><\/pre>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li><strong>\u6d4b\u8bd5<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u8bbf\u95ee <code>http:\/\/127.0.0.1:9501\/hello<\/code>\uff0c\u670d\u52a1\u5668\u5c06\u8fd4\u56de &#8220;Hello, Swoole!&#8221;\uff0c\u5e76\u4e14\u652f\u6301\u9759\u6001\u6587\u4ef6\u7684\u52a0\u8f7d\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1.3 <strong>\u4f18\u5316\u5efa\u8bae<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u957f\u8fde\u63a5<\/strong>\uff1aSwoole \u652f\u6301 HTTP \u957f\u8fde\u63a5\uff0c\u9002\u7528\u4e8e\u9700\u8981\u9891\u7e41\u4ea4\u4e92\u7684\u5ba2\u6237\u7aef\u3002<\/li>\n\n\n\n<li><strong>\u8fdb\u7a0b\u7ba1\u7406<\/strong>\uff1a\u6839\u636e\u7cfb\u7edf\u8d44\u6e90\u548c\u8d1f\u8f7d\u60c5\u51b5\uff0c\u5408\u7406\u8bbe\u7f6e <code>worker_num<\/code> \u548c <code>task_worker_num<\/code>\uff0c\u4ee5\u5145\u5206\u5229\u7528\u670d\u52a1\u5668\u7684\u591a\u6838\u5904\u7406\u80fd\u529b\u3002<\/li>\n\n\n\n<li><strong>\u5f02\u6b65 I\/O<\/strong>\uff1a\u4f7f\u7528\u534f\u7a0b\u6765\u907f\u514d I\/O \u963b\u585e\uff0c\u5c24\u5176\u5728\u9ad8\u5e76\u53d1\u7684\u8bf7\u6c42\u4e2d\uff0c\u907f\u514d\u9891\u7e41\u7684\u521b\u5efa\u548c\u9500\u6bc1\u8fdb\u7a0b\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2. <strong>\u5373\u65f6\u804a\u5929\u5e94\u7528<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Swoole \u662f\u5b9e\u73b0\u9ad8\u5e76\u53d1\u3001\u5b9e\u65f6\u901a\u8baf\u7cfb\u7edf\uff08\u5982 WebSocket \u670d\u52a1\uff09\u7406\u60f3\u7684\u6846\u67b6\u3002\u5728\u5373\u65f6\u804a\u5929\u5e94\u7528\u4e2d\uff0cSwoole \u7684 WebSocket \u670d\u52a1\u5668\u975e\u5e38\u9002\u5408\u7528\u6765\u5904\u7406\u9ad8\u9891\u7387\u7684\u6d88\u606f\u4f20\u9012\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2.1 <strong>\u9879\u76ee\u80cc\u666f<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684 WebSocket \u804a\u5929\u5e94\u7528\uff0c\u652f\u6301\u591a\u4eba\u5b9e\u65f6\u804a\u5929\u3002\u6bcf\u5f53\u7528\u6237\u53d1\u9001\u6d88\u606f\u65f6\uff0c\u670d\u52a1\u5668\u5c06\u5e7f\u64ad\u6d88\u606f\u7ed9\u6240\u6709\u5728\u7ebf\u7684\u7528\u6237\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2.2 <strong>\u6b65\u9aa4<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u521b\u5efa WebSocket \u670d\u52a1\u5668<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\/\/ websocket-server.php\n\n\/\/ \u521b\u5efa Swoole WebSocket \u670d\u52a1\u5668\n$ws = new Swoole\\WebSocket\\Server(\"127.0.0.1\", 9502);\n\n\/\/ \u8bbe\u7f6e WebSocket \u670d\u52a1\u5668\u914d\u7f6e\n$ws-&gt;set(&#91;\n    'worker_num' =&gt; 4,  \/\/ \u5de5\u4f5c\u8fdb\u7a0b\u6570\n]);\n\n\/\/ \u5b9a\u4e49 WebSocket \u4e8b\u4ef6\u56de\u8c03\n$ws-&gt;on(\"open\", function ($ws, $request) {\n    echo \"Client {$request-&gt;fd} connected\\n\";\n});\n\n$ws-&gt;on(\"message\", function ($ws, $frame) {\n    echo \"Received message: {$frame-&gt;data}\\n\";\n    \/\/ \u5e7f\u64ad\u6d88\u606f\u7ed9\u6240\u6709\u5ba2\u6237\u7aef\n    foreach ($ws-&gt;connections as $fd) {\n        if ($fd != $frame-&gt;fd) {  \/\/ \u4e0d\u53d1\u9001\u7ed9\u81ea\u5df1\n            $ws-&gt;push($fd, \"User {$frame-&gt;fd} says: {$frame-&gt;data}\");\n        }\n    }\n});\n\n$ws-&gt;on(\"close\", function ($ws, $fd) {\n    echo \"Client {$fd} disconnected\\n\";\n});\n\n\/\/ \u542f\u52a8 WebSocket \u670d\u52a1\u5668\n$ws-&gt;start();<\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u8fd0\u884c\u670d\u52a1\u5668<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>php websocket-server.php<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>\u524d\u7aef\u793a\u4f8b<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n&lt;head&gt;\n    &lt;meta charset=\"UTF-8\"&gt;\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\n    &lt;title&gt;WebSocket Chat&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;div id=\"messages\"&gt;&lt;\/div&gt;\n    &lt;input id=\"input\" type=\"text\" placeholder=\"Type a message\"&gt;\n    &lt;script&gt;\n        const ws = new WebSocket('ws:\/\/127.0.0.1:9502');\n\n        ws.onopen = function() {\n            console.log('Connected to the server');\n        };\n\n        ws.onmessage = function(event) {\n            const messagesDiv = document.getElementById('messages');\n            messagesDiv.innerHTML += `&lt;p&gt;${event.data}&lt;\/p&gt;`;\n        };\n\n        document.getElementById('input').addEventListener('keypress', function(event) {\n            if (event.key === 'Enter') {\n                ws.send(event.target.value);\n                event.target.value = '';\n            }\n        });\n    &lt;\/script&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li><strong>\u6d4b\u8bd5<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6253\u5f00\u591a\u4e2a\u6d4f\u89c8\u5668\u7a97\u53e3\uff0c\u8bbf\u95ee HTML \u9875\u9762\uff0c\u7528\u6237\u53ef\u4ee5\u5b9e\u65f6\u53d1\u9001\u548c\u63a5\u6536\u804a\u5929\u6d88\u606f\u3002<\/li>\n\n\n\n<li>\u6bcf\u4e2a\u7528\u6237\u8fde\u63a5\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7 WebSocket \u4e0e\u670d\u52a1\u5668\u4ea4\u4e92\uff0c\u670d\u52a1\u5668\u4f1a\u5c06\u6d88\u606f\u5e7f\u64ad\u7ed9\u6240\u6709\u5176\u4ed6\u5728\u7ebf\u7528\u6237\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2.3 <strong>\u4f18\u5316\u5efa\u8bae<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5206\u5e03\u5f0f<\/strong>\uff1aSwoole \u53ef\u4ee5\u901a\u8fc7 Redis \u6216\u5176\u4ed6\u6d88\u606f\u4e2d\u95f4\u4ef6\u5b9e\u73b0\u591a\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u6d88\u606f\u5e7f\u64ad\uff0c\u4f7f\u5f97\u804a\u5929\u5e94\u7528\u53ef\u4ee5\u6a2a\u5411\u6269\u5c55\u3002<\/li>\n\n\n\n<li><strong>\u534f\u7a0b\u4f18\u5316<\/strong>\uff1a\u4f7f\u7528\u534f\u7a0b\u5904\u7406 WebSocket \u8fde\u63a5\u548c\u6d88\u606f\u4f20\u9012\uff0c\u907f\u514d\u963b\u585e\u64cd\u4f5c\uff0c\u63d0\u5347\u6027\u80fd\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3. <strong>\u5f02\u6b65\u4efb\u52a1\u961f\u5217\u7cfb\u7edf<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Swoole \u9002\u5408\u5904\u7406\u9ad8\u5e76\u53d1\u7684\u5f02\u6b65\u4efb\u52a1\u961f\u5217\uff0c\u652f\u6301\u4efb\u52a1\u7684\u5f02\u6b65\u6267\u884c\u548c\u5206\u5e03\u5f0f\u4efb\u52a1\u961f\u5217\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528 Swoole \u5b9e\u73b0\u4e00\u4e2a\u7b80\u5355\u7684\u5f02\u6b65\u4efb\u52a1\u961f\u5217\u7684\u793a\u4f8b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3.1 <strong>\u9879\u76ee\u80cc\u666f<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u9700\u8981\u5904\u7406\u5f02\u6b65\u4efb\u52a1\uff08\u5982\u53d1\u9001\u90ae\u4ef6\u3001\u56fe\u7247\u5904\u7406\u7b49\uff09\u7684\u573a\u666f\u4e2d\uff0cSwoole \u7684\u4efb\u52a1\u534f\u7a0b\u975e\u5e38\u9002\u5408\u6b64\u7c7b\u5e94\u7528\u3002\u4efb\u52a1\u53ef\u4ee5\u5f02\u6b65\u6267\u884c\uff0c\u800c\u4e0d\u963b\u585e\u4e3b\u7ebf\u7a0b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3.2 <strong>\u6b65\u9aa4<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u521b\u5efa Swoole \u4efb\u52a1\u961f\u5217<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\/\/ task-queue.php\n\n\/\/ \u521b\u5efa Swoole Server\n$server = new Swoole\\Server(\"127.0.0.1\", 9503);\n\n\/\/ \u8bbe\u7f6e\u5de5\u4f5c\u8fdb\u7a0b\u6570\u548c\u4efb\u52a1\u8fdb\u7a0b\u6570\n$server-&gt;set(&#91;\n    'worker_num' =&gt; 2,\n    'task_worker_num' =&gt; 4,\n]);\n\n\/\/ \u4efb\u52a1\u56de\u8c03\n$server-&gt;on('task', function ($server, $task_id, $from_id, $data) {\n    echo \"Processing task: $data\\n\";\n    sleep(2); \/\/ \u6a21\u62df\u5904\u7406\u4efb\u52a1\n    return \"Task completed: $data\";\n});\n\n\/\/ \u5b8c\u6210\u4efb\u52a1\u56de\u8c03\n$server-&gt;on('finish', function ($server, $task_id, $data) {\n    echo \"Task finished: $data\\n\";\n});\n\n\/\/ \u542f\u52a8\u670d\u52a1\u5668\n$server-&gt;start();<\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u53d1\u9001\u4efb\u52a1\u8bf7\u6c42<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\/\/ client.php\n\n$client = new Swoole\\Client(SWOOLE_SOCK_TCP);\n$client-&gt;connect('127.0.0.1', 9503);\n\n\/\/ \u53d1\u9001\u4efb\u52a1\u8bf7\u6c42\n$task_id = $client-&gt;task(\"Send email to user@example.com\");\n\n\/\/ \u83b7\u53d6\u4efb\u52a1\u5b8c\u6210\u7ed3\u679c\n$result = $client-&gt;recv();\necho \"Received result: $result\\n\";<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>\u6d4b\u8bd5<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u542f\u52a8 <code>task-queue.php<\/code> \u670d\u52a1\u7aef\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528 <code>client.php<\/code> \u6a21\u62df\u4efb\u52a1\u8bf7\u6c42\uff0c\u670d\u52a1\u5668\u4f1a\u5f02\u6b65\u5904\u7406\u4efb\u52a1\uff0c\u5e76\u8fd4\u56de\u4efb\u52a1\u7ed3\u679c\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3.3 <strong>\u4f18\u5316\u5efa\u8bae<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u4efb\u52a1\u5206\u53d1\u4e0e\u8c03\u5ea6<\/strong>\uff1a\u53ef\u4ee5\u6839\u636e\u4efb\u52a1\u7684\u4f18\u5148\u7ea7\u3001\u7c7b\u578b\u6765\u8fdb\u884c\u66f4\u7ec6\u7c92\u5ea6\u7684\u5206\u53d1\u548c\u8c03\u5ea6\u3002<\/li>\n\n\n\n<li><strong>\u6570\u636e\u5e93\u64cd\u4f5c\u4f18\u5316<\/strong>\uff1a\u5bf9\u4e8e\u9700\u8981\u8bbf\u95ee\u6570\u636e\u5e93\u7684\u4efb\u52a1\uff0c\u4f7f\u7528\u534f\u7a0b\u6765\u5904\u7406\u6570\u636e\u5e93\u64cd\u4f5c\uff0c\u907f\u514d\u4f20\u7edf\u963b\u585e I\/O\u3002<\/li>\n\n\n\n<li><strong>\u5206\u5e03\u5f0f\u4efb\u52a1\u961f\u5217<\/strong>\uff1a\u7ed3\u5408 Redis \u6216 Kafka \u7b49\u6d88\u606f\u961f\u5217\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5206\u5e03\u5f0f\u4efb\u52a1\u5904\u7406\u7cfb\u7edf\uff0c\u4fdd\u8bc1\u9ad8\u53ef\u7528\u548c\u9ad8\u6269\u5c55\u6027\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u603b\u7ed3<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7\u8fd9\u4e9b\u5b9e\u6218\u9879\u76ee\uff0c\u60a8\u53ef\u4ee5\u638c\u63e1 Swoole \u5728\u4e0d\u540c\u573a\u666f\u4e0b\u7684\u5e94\u7528\uff0c\u5305\u62ec\u9ad8\u6027\u80fd Web \u670d\u52a1\u5668\u3001\u5b9e\u65f6\u804a\u5929\u5e94\u7528\u548c\u5f02\u6b65\u4efb\u52a1\u961f\u5217\u7b49\u3002\u901a\u8fc7\u4e0d\u65ad\u7684\u4f18\u5316\u4e0e\u8c03\u4f18\uff0c\u60a8\u53ef\u4ee5\u5145\u5206\u53d1\u6325 Swoole \u7684\u6027\u80fd\u4f18\u52bf\uff0c\u63d0\u5347\u5e94\u7528\u7684\u5e76\u53d1\u5904\u7406\u80fd\u529b\u548c\u6269\u5c55\u6027\u3002\u8fd9\u4e9b\u5b9e\u6218\u9879\u76ee\u4e0d\u4ec5\u80fd\u5e2e\u52a9\u60a8\u7406\u89e3 Swoole \u7684\u57fa\u672c\u4f7f\u7528\uff0c\u8fd8\u80fd\u8ba9\u60a8\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\u719f\u7ec3\u5e94\u7528\u5b83\u7684\u5f3a\u5927\u529f\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Swoole \u63d0\u4f9b\u4e86\u9ad8\u6027\u80fd\u7684\u534f\u7a0b\u548c\u591a\u8fdb\u7a0b\u6a21\u578b\uff0c\u9002\u7528\u4e8e\u9700\u8981\u5904\u7406\u5927\u91cf\u5e76\u53d1\u8bf7\u6c42\u3001\u957f\u8fde\u63a5\u3001\u9ad8\u541e\u5410\u91cf\u7b49\u573a\u666f\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u57fa [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64],"tags":[],"class_list":["post-1078","post","type-post","status-publish","format-standard","hentry","category-swoole"],"_links":{"self":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1078","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/comments?post=1078"}],"version-history":[{"count":2,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1078\/revisions"}],"predecessor-version":[{"id":1118,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1078\/revisions\/1118"}],"wp:attachment":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/media?parent=1078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/categories?post=1078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/tags?post=1078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}