swoole官网下载的windows二进制版本,测试httpserver没响应
从这里https://www.swoole.com/page/d...
下载的4.3.2-rc2windows版本。
httpserver代码用的是
<?php
$http = new swoole_http_server("127.0.0.1", 9501);
$http->on("start", function ($server) {
echo "Swoole http server is started at http://127.0.0.1:9501\n";
});
$http->on("request", function ($request, $response) {
$response->header("Content-Type", "text/plain");
$response->end("Hello World\n");
});
$http->start();
swoole解压,运行目录下的binphp http.php 在dos窗口运行启动了。
看到 Swoole http server is started at http://127.0.0.1:9501 这句输出
然后在浏览器访问http://127.0.0.1:9501/浏览器一直没响应。dos窗口也没有反应
今天突然发现swoole源码中


https://github.com/swoole/swo...
这个server.php 比swoole官网首页的http_server
长好多,报着试一试的心态,结果看到久违的结果
经过简单对比实验,问题就出在
swoole_http_server的第三个参数 SWOOLE_BASE
加上这个参数就正常,缺省这个参数,就没有响应了。
记录在这里,望碰到同样问题的同学看到。

不知道这些信息,是否有帮助?