{"id":24205,"date":"2024-11-21T15:52:42","date_gmt":"2024-11-21T07:52:42","guid":{"rendered":"https:\/\/fwq.ai\/blog\/24205\/"},"modified":"2024-11-21T15:52:42","modified_gmt":"2024-11-21T07:52:42","slug":"%e8%a7%a3%e5%af%86swoole%e7%9a%84%e5%8d%8f%e7%a8%8b%e7%89%b9%e6%80%a7%ef%bc%9a%e5%bc%80%e5%8f%91%e5%8a%9f%e8%83%bd%e7%9a%84%e6%96%b0%e5%a2%83%e7%95%8c","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/24205\/","title":{"rendered":"\u89e3\u5bc6swoole\u7684\u534f\u7a0b\u7279\u6027\uff1a\u5f00\u53d1\u529f\u80fd\u7684\u65b0\u5883\u754c"},"content":{"rendered":"<p>\u89e3\u5bc6\u7684\u534f\u7a0b\u7279\u6027\uff1a\u5f00\u53d1\u529f\u80fd\u7684\u65b0\u5883\u754c<\/p>\n<p>\u968f\u7740\u4e92\u8054\u7f51\u7684\u5feb\u901f\u53d1\u5c55\uff0c\u4f20\u7edf\u7684Web\u5f00\u53d1\u65b9\u5f0f\u5df2\u7ecf\u65e0\u6cd5\u6ee1\u8db3\u65e5\u76ca\u589e\u957f\u7684\u7528\u6237\u9700\u6c42\u3002\u5728\u9ad8\u5e76\u53d1\u3001\u9ad8\u6027\u80fd\u3001\u9ad8\u53ef\u9760\u6027\u65b9\u9762\uff0cPHP\u4f5c\u4e3a\u4e00\u79cd\u811a\u672c\u8bed\u8a00\uff0c\u957f\u671f\u4ee5\u6765\u5907\u53d7\u8bdf\u75c5\u3002\u7136\u800c\uff0c\u968f\u7740swoole\u7684\u51fa\u73b0\uff0cPHP\u5f00\u53d1\u8005\u7ec8\u4e8e\u8fce\u6765\u4e86\u4e00\u4e1d\u66d9\u5149\u3002<\/p>\n<p>swoole\u662f\u4e00\u6b3e\u9762\u5411PHP\u7684\u9ad8\u6027\u80fd\u7f51\u7edc\u901a\u4fe1\u5f15\u64ce\u548c\u5f02\u6b65\u591a\u7ebf\u7a0b\u6846\u67b6\uff0c\u901a\u8fc7\u4f7f\u7528swoole\u534f\u7a0b\u7279\u6027\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06PHP\u7a0b\u5e8f\u8f6c\u5316\u4e3a\u534f\u7a0b\u6a21\u5f0f\uff0c\u4ece\u800c\u5b9e\u73b0\u66f4\u9ad8\u6548\u7684\u5f00\u53d1\u3002<\/p>\n<ol>\n<li>swoole\u7b80\u4ecb<\/li>\n<\/ol>\n<p>swoole\u662f\u4e00\u4e2aC\u7f16\u5199\u7684PHP\u6269\u5c55\uff0c\u901a\u8fc7\u4f7f\u7528swoole\u6269\u5c55\uff0c\u6211\u4eec\u53ef\u4ee5\u5728PHP\u4e2d\u4f7f\u7528\u539f\u751f\u7684\u5f02\u6b65\u591a\u7ebf\u7a0b\u6280\u672f\uff0c\u8f7b\u677e\u5b9e\u73b0\u9ad8\u6027\u80fd\u7684\u5e76\u53d1\u7f16\u7a0b\u3002swoole\u652f\u6301TCP\/UDP\/UnixSocket\u534f\u8bae\uff0c\u540c\u65f6\u4e5f\u652f\u6301\u5f02\u6b65\u6216\u540c\u6b65\u7684\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u3002<\/p>\n<p>\u5728swoole\u4e2d\uff0c\u6700\u5f15\u4eba\u6ce8\u76ee\u7684\u7279\u6027\u4e4b\u4e00\u5c31\u662f\u534f\u7a0b\u3002\u534f\u7a0b\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u7ebf\u7a0b\uff0c\u53ef\u4ee5\u5728\u4e00\u4e2a\u7ebf\u7a0b\u4e2d\u5b9e\u73b0\u7c7b\u4f3c\u591a\u7ebf\u7a0b\u7684\u5e76\u53d1\u6a21\u5f0f\uff0c\u4f46\u662f\u5360\u7528\u7684\u8d44\u6e90\u66f4\u5c11\u3002\u901a\u8fc7swoole\u534f\u7a0b\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u534f\u7a0b\u8c03\u5ea6\u3001\u534f\u7a0b\u5207\u6362\u7b49\u529f\u80fd\uff0c\u5927\u5927\u63d0\u9ad8\u4e86PHP\u7684\u7f16\u7a0b\u6548\u7387\u3002<\/p>\n<ol>\n<li>swoole\u534f\u7a0b\u57fa\u7840<\/li>\n<\/ol>\n<p>\u534f\u7a0b\u7684\u4f7f\u7528\u975e\u5e38\u7b80\u5355\uff0c\u6211\u4eec\u53ea\u9700\u8981\u5728\u4ee3\u7801\u4e2d\u52a0\u5165\u5173\u952e\u8bcdyield\u548cCo::xxx\u5373\u53ef\u3002\u4e0b\u9762\u6211\u4eec\u4f7f\u7528\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u6765\u6f14\u793aswoole\u534f\u7a0b\u7684\u57fa\u7840\u7528\u6cd5\u3002<\/p>\n<p>\u9996\u5148\uff0c\u8ba9\u6211\u4eec\u5b89\u88c5swoole\u6269\u5c55\uff0c\u5e76\u542f\u52a8\u4e00\u4e2a\u7b80\u5355\u7684HTTP\u670d\u52a1\u5668\u3002<\/p>\n<pre>$http = new swoole_http_server(\"127.0.0.1\", 9501);\n\n$http-&amp;gt;on(\"request\", function ($request, $response) {\n    $response-&amp;gt;header(\"Content-Type\", \"text\/plain\");\n    $response-&amp;gt;end(\"Hello World\n\");\n});\n\n$http-&amp;gt;start();<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2aHTTP\u670d\u52a1\u5668\uff0c\u5e76\u6307\u5b9a\u76d1\u542c\u7684IP\u5730\u5740\u548c\u7aef\u53e3\u3002\u5f53\u6709\u8bf7\u6c42\u8fdb\u6765\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u8c03\u7528\u56de\u8c03\u51fd\u6570on(&#8220;request&#8221;, function ($request, $response) {})\u6765\u5904\u7406\u8bf7\u6c42\u3002<\/p>\n<p>\u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u534f\u7a0b\u7684\u7279\u6027\u6765\u8fdb\u884c\u5f02\u6b65\u7f16\u7a0b\u4e86\u3002\u6211\u4eec\u4fee\u6539\u4e00\u4e0b\u56de\u8c03\u51fd\u6570\uff0c\u4f7f\u5176\u652f\u6301\u534f\u7a0b\u3002<\/p>\n<pre>$http = new swoole_http_server(\"127.0.0.1\", 9501);\n\n$http-&amp;gt;on(\"request\", function ($request, $response) {\n    $response-&amp;gt;header(\"Content-Type\", \"text\/plain\");\n    $content = Co::exec(\"ls -al\");\n    $response-&amp;gt;end($content);\n});\n\n$http-&amp;gt;start();<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86swoole\u7684Co::exec\u65b9\u6cd5\u6765\u6267\u884c\u547d\u4ee4ls -al\uff0c\u5e76\u5c06\u7ed3\u679c\u8d4b\u503c\u7ed9\u53d8\u91cf$content\uff0c\u6700\u540e\u5c06\u7ed3\u679c\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u3002<\/p>\n<p>\u901a\u8fc7\u8fd9\u4e2a\u793a\u4f8b\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c\u5728swoole\u7684\u534f\u7a0b\u73af\u5883\u4e0b\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u4e00\u4e2a\u7ebf\u7a0b\u4e2d\u50cf\u7f16\u5199\u540c\u6b65\u4ee3\u7801\u4e00\u6837\u5b9e\u73b0\u5f02\u6b65\u8c03\u7528\u3002<\/p>\n<ol>\n<li>swoole\u534f\u7a0b\u9ad8\u7ea7\u7528\u6cd5<\/li>\n<\/ol>\n<p>\u9664\u4e86\u57fa\u672c\u7684\u534f\u7a0b\u529f\u80fd\uff0cswoole\u8fd8\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7ea7\u7684\u534f\u7a0b\u7279\u6027\uff0c\u6bd4\u5982\u534f\u7a0b\u8c03\u5ea6\u5668\u3001\u534f\u7a0b\u5207\u6362\u7b49\u3002<\/p>\n<p>\u534f\u7a0b\u8c03\u5ea6\u5668\u662fswoole\u63d0\u4f9b\u7684\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u529f\u80fd\uff0c\u5b83\u8d1f\u8d23\u534f\u8c03\u591a\u4e2a\u534f\u7a0b\u7684\u6267\u884c\u987a\u5e8f\u3002\u5728swoole\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7swoole\u63d0\u4f9b\u7684\u5404\u79cd\u534f\u7a0b\u8c03\u5ea6\u5668\u6765\u5b9e\u73b0\u81ea\u5df1\u7684\u8c03\u5ea6\u7b56\u7565\uff0c\u6bd4\u5982\u5e76\u53d1\u6267\u884c\u3001\u987a\u5e8f\u6267\u884c\u7b49\u3002<\/p>\n<p>\u534f\u7a0b\u8c03\u5ea6\u5668\u7684\u57fa\u672c\u7528\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>$scheduler = new CoroutineScheduler;\n\n$scheduler-&amp;gt;add(function () {\n    \/\/ \u534f\u7a0b1\n    Co::sleep(1);\n    echo \"Coroutine 1\n\";\n});\n\n$scheduler-&amp;gt;add(function () {\n    \/\/ \u534f\u7a0b2\n    Co::sleep(2);\n    echo \"Coroutine 2\n\";\n});\n\n$scheduler-&amp;gt;start();<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2ascheduler\u5bf9\u8c61\uff0c\u5e76\u4f7f\u7528scheduler\u5bf9\u8c61\u7684add\u65b9\u6cd5\u52a0\u5165\u4e24\u4e2a\u534f\u7a0b\uff0c\u5206\u522b\u6267\u884cCo::sleep(1)\u548cCo::sleep(2)\u3002\u6700\u540e\uff0c\u901a\u8fc7scheduler\u5bf9\u8c61\u7684start\u65b9\u6cd5\u542f\u52a8\u8c03\u5ea6\u5668\u3002<\/p>\n<p>\u5728swoole\u534f\u7a0b\u73af\u5883\u4e0b\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u534f\u7a0b\u5207\u6362\u6765\u5b9e\u73b0\u66f4\u9ad8\u7ea7\u7684\u5f02\u6b65\u7f16\u7a0b\u3002<\/p>\n<pre>\/\/ \u521b\u5efa\u534f\u7a0b\n$scheduler = new CoroutineScheduler;\n\n$scheduler-&amp;gt;add(function () {\n    $ch1 = curl_init();\n    curl_setopt($ch1, CURLOPT_URL, \"http:\/\/www.example.com\");\n    Co::yield($ch1);\n\n    $ch2 = curl_init();\n    curl_setopt($ch2, CURLOPT_URL, \"http:\/\/www.swoole.com\");\n    Co::yield($ch2);\n\n    $ch3 = curl_init();\n    curl_setopt($ch3, CURLOPT_URL, \"http:\/\/www.baidu.com\");\n    Co::yield($ch3);\n});\n\n\/\/ \u6267\u884c\u534f\u7a0b\n$scheduler-&amp;gt;start();<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u534f\u7a0b\u5207\u6362\u6765\u5b9e\u73b0\u4e86\u4f7f\u7528curl\u5e93\u53d1\u8d77\u591a\u4e2aHTTP\u8bf7\u6c42\u7684\u529f\u80fd\u3002<\/p>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u793a\u4f8b\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u51fa\uff0c\u4f7f\u7528swoole\u534f\u7a0b\u7279\u6027\uff0c\u6211\u4eec\u53ef\u4ee5\u50cf\u540c\u6b65\u7f16\u7a0b\u4e00\u6837\u7f16\u5199\u5f02\u6b65\u4ee3\u7801\uff0c\u5927\u5927\u63d0\u9ad8\u4e86\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<ol>\n<li>\u603b\u7ed3<\/li>\n<\/ol>\n<p>\u901a\u8fc7\u672c\u6587\u7684\u4ecb\u7ecd\uff0c\u6211\u4eec\u4e86\u89e3\u4e86swoole\u7684\u534f\u7a0b\u7279\u6027\uff0c\u5e76\u6f14\u793a\u4e86\u51e0\u4e2a\u4f7f\u7528swoole\u534f\u7a0b\u7684\u57fa\u7840\u548c\u9ad8\u7ea7\u7528\u6cd5\u3002<\/p>\n<p>swoole\u7684\u534f\u7a0b\u7279\u6027\u4e3aPHP\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u5168\u65b0\u7684\u5f00\u53d1\u6a21\u5f0f\u548c\u529f\u80fd\uff0c\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u9ad8\u6027\u80fd\u7684\u5e76\u53d1\u7f16\u7a0b\u3002\u5728\u5e94\u5bf9\u9ad8\u5e76\u53d1\u3001\u9ad8\u6027\u80fd\u3001\u9ad8\u53ef\u9760\u6027\u7b49\u573a\u666f\u65f6\uff0cswoole\u7684\u534f\u7a0b\u7279\u6027\u5c55\u73b0\u4e86\u5f3a\u5927\u7684\u5b9e\u529b\u3002<\/p>\n<p>\u672a\u6765\uff0c\u968f\u7740swoole\u534f\u7a0b\u7279\u6027\u7684\u4e0d\u65ad\u5b8c\u5584\u548c\u4f18\u5316\uff0c\u76f8\u4fe1swoole\u5c06\u4f1a\u5728Web\u5f00\u53d1\u9886\u57df\u5927\u653e\u5f02\u5f69\uff0c\u6210\u4e3aPHP\u5f00\u53d1\u8005\u7684\u5f97\u529b\u52a9\u624b\u3002\u8ba9\u6211\u4eec\u62ed\u76ee\u4ee5\u5f85\uff01<\/p>\n<p>\u53c2\u8003\u94fe\u63a5\uff1a<\/p>\n<ol>\n<li>swoole\u5b98\u65b9\u6587\u6863\uff1ahttps:\/\/www.swoole.com\/<\/li>\n<li>swoole GitHub\u4ed3\u5e93\uff1ahttps:\/\/github.com\/swoole\/swoole-src<\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\u5c31\u662f\u89e3\u5bc6\u7684\u534f\u7a0b\u7279\u6027\uff1a\u5f00\u53d1\u529f\u80fd\u7684\u65b0\u5883\u754c\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u89e3\u5bc6\u7684\u534f\u7a0b\u7279\u6027\uff1a\u5f00\u53d1\u529f\u80fd\u7684\u65b0\u5883\u754c \u968f\u7740\u4e92\u8054\u7f51\u7684\u5feb\u901f\u53d1\u5c55\uff0c\u4f20\u7edf\u7684Web\u5f00\u53d1\u65b9\u5f0f\u5df2\u7ecf\u65e0\u6cd5\u6ee1\u8db3\u65e5\u76ca\u589e\u957f\u7684\u7528\u6237\u9700\u6c42\u3002\u5728\u9ad8\u5e76\u53d1\u3001\u9ad8\u6027\u80fd\u3001\u9ad8\u53ef\u9760\u6027\u65b9\u9762\uff0cPHP\u4f5c\u4e3a\u4e00\u79cd\u811a\u672c\u8bed\u8a00\uff0c\u957f\u671f\u4ee5\u6765\u5907\u53d7\u8bdf\u75c5\u3002\u7136\u800c\uff0c\u968f\u7740swoole\u7684\u51fa\u73b0\uff0cPHP\u5f00\u53d1\u8005\u7ec8\u4e8e\u8fce\u6765\u4e86\u4e00\u4e1d\u66d9\u5149\u3002 swoole\u662f\u4e00\u6b3e\u9762\u5411PHP\u7684\u9ad8\u6027\u80fd\u7f51\u7edc\u901a\u4fe1\u5f15\u64ce\u548c\u5f02\u6b65\u591a\u7ebf\u7a0b\u6846\u67b6\uff0c\u901a\u8fc7\u4f7f\u7528swoole\u534f\u7a0b\u7279\u6027\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06PHP\u7a0b\u5e8f\u8f6c\u5316\u4e3a\u534f\u7a0b\u6a21\u5f0f\uff0c\u4ece\u800c\u5b9e\u73b0\u66f4\u9ad8\u6548\u7684\u5f00\u53d1\u3002 swoole\u7b80\u4ecb swoole\u662f\u4e00\u4e2aC\u7f16\u5199\u7684PHP\u6269\u5c55\uff0c\u901a\u8fc7\u4f7f\u7528swoole\u6269\u5c55\uff0c\u6211\u4eec\u53ef\u4ee5\u5728PHP\u4e2d\u4f7f\u7528\u539f\u751f\u7684\u5f02\u6b65\u591a\u7ebf\u7a0b\u6280\u672f\uff0c\u8f7b\u677e\u5b9e\u73b0\u9ad8\u6027\u80fd\u7684\u5e76\u53d1\u7f16\u7a0b\u3002swoole\u652f\u6301TCP\/UDP\/UnixSocket\u534f\u8bae\uff0c\u540c\u65f6\u4e5f\u652f\u6301\u5f02\u6b65\u6216\u540c\u6b65\u7684\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u3002 \u5728swoole\u4e2d\uff0c\u6700\u5f15\u4eba\u6ce8\u76ee\u7684\u7279\u6027\u4e4b\u4e00\u5c31\u662f\u534f\u7a0b\u3002\u534f\u7a0b\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u7ebf\u7a0b\uff0c\u53ef\u4ee5\u5728\u4e00\u4e2a\u7ebf\u7a0b\u4e2d\u5b9e\u73b0\u7c7b\u4f3c\u591a\u7ebf\u7a0b\u7684\u5e76\u53d1\u6a21\u5f0f\uff0c\u4f46\u662f\u5360\u7528\u7684\u8d44\u6e90\u66f4\u5c11\u3002\u901a\u8fc7swoole\u534f\u7a0b\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u534f\u7a0b\u8c03\u5ea6\u3001\u534f\u7a0b\u5207\u6362\u7b49\u529f\u80fd\uff0c\u5927\u5927\u63d0\u9ad8\u4e86PHP\u7684\u7f16\u7a0b\u6548\u7387\u3002 swoole\u534f\u7a0b\u57fa\u7840 \u534f\u7a0b\u7684\u4f7f\u7528\u975e\u5e38\u7b80\u5355\uff0c\u6211\u4eec\u53ea\u9700\u8981\u5728\u4ee3\u7801\u4e2d\u52a0\u5165\u5173\u952e\u8bcdyield\u548cCo::xxx\u5373\u53ef\u3002\u4e0b\u9762\u6211\u4eec\u4f7f\u7528\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u6765\u6f14\u793aswoole\u534f\u7a0b\u7684\u57fa\u7840\u7528\u6cd5\u3002 \u9996\u5148\uff0c\u8ba9\u6211\u4eec\u5b89\u88c5swoole\u6269\u5c55\uff0c\u5e76\u542f\u52a8\u4e00\u4e2a\u7b80\u5355\u7684HTTP\u670d\u52a1\u5668\u3002 $http = new swoole_http_server(&#8220;127.0.0.1&#8221;, 9501); $http-&amp;gt;on(&#8220;request&#8221;, function ($request, $response) { $response-&amp;gt;header(&#8220;Content-Type&#8221;, &#8220;text\/plain&#8221;); $response-&amp;gt;end(&#8220;Hello World &#8220;); }); $http-&amp;gt;start(); \u767b\u5f55\u540e\u590d\u5236 \u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2aHTTP\u670d\u52a1\u5668\uff0c\u5e76\u6307\u5b9a\u76d1\u542c\u7684IP\u5730\u5740\u548c\u7aef\u53e3\u3002\u5f53\u6709\u8bf7\u6c42\u8fdb\u6765\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u8c03\u7528\u56de\u8c03\u51fd\u6570on(&#8220;request&#8221;, function ($request, $response) {})\u6765\u5904\u7406\u8bf7\u6c42\u3002 \u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u534f\u7a0b\u7684\u7279\u6027\u6765\u8fdb\u884c\u5f02\u6b65\u7f16\u7a0b\u4e86\u3002\u6211\u4eec\u4fee\u6539\u4e00\u4e0b\u56de\u8c03\u51fd\u6570\uff0c\u4f7f\u5176\u652f\u6301\u534f\u7a0b\u3002 $http = new swoole_http_server(&#8220;127.0.0.1&#8221;, 9501); $http-&amp;gt;on(&#8220;request&#8221;, function ($request, $response) { $response-&amp;gt;header(&#8220;Content-Type&#8221;, &#8220;text\/plain&#8221;); $content = Co::exec(&#8220;ls -al&#8221;); $response-&amp;gt;end($content); }); $http-&amp;gt;start(); \u767b\u5f55\u540e\u590d\u5236 \u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86swoole\u7684Co::exec\u65b9\u6cd5\u6765\u6267\u884c\u547d\u4ee4ls -al\uff0c\u5e76\u5c06\u7ed3\u679c\u8d4b\u503c\u7ed9\u53d8\u91cf$content\uff0c\u6700\u540e\u5c06\u7ed3\u679c\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-24205","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/24205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=24205"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/24205\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=24205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=24205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=24205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}