首页
下载
文档
社区
视频
捐赠
源代码
赞助商
AOT 编译器
AI 助理
商业产品
PHP AOT 原生编译器
Swoole-Compiler 代码加密器
CRMEB 新零售社交电商系统
登录
注册
全部
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
发表新帖
代码中请求自己域名的链接无法响应
### 问题描述 在项目中请求自己域名的链接,会因为进程数太少而陷入死循环。 如下面代码请求 http://127.0.0.1:9501/test 地址无法响应。 加大进程数在并发量多的情况下还是会无法响应。 ### Swoole版本,PHP版本,以及操作系统版本信息 Swoole:4.6.4 PHP:7.4 OS:Centos ### 相关代码 ```php <?php $http = new Swoole\Http\Server('0.0.0.0', 9501); $http->set(['worker_num' => 1]); $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) { if($request->server['path_info']=='/test'){ $response->end(file_get_contents('http://127.0.0.1:9501')); }else{ $response->end('Hello World'); } }); $http->start(); ```
发布于5年前 · 5 次浏览 · 来自
提问
sff
### 问题描述 在项目中请求自己域名的链接,会因为进程数太少而陷入死循环。 如下面代码请求 http://127.0.0.1:9501/test 地址无法响应。 加大进程数在并发量多的情况下还是会无法响应。 ### Swoole版本,PHP版本,以及操作系统版本信息 Swoole:4.6.4 PHP:7.4 OS:Centos ### 相关代码 ```php <?php $http = new Swoole\Http\Server('0.0.0.0', 9501); $http->set(['worker_num' => 1]); $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) { if($request->server['path_info']=='/test'){ $response->end(file_get_contents('http://127.0.0.1:9501')); }else{ $response->end('Hello World'); } }); $http->start(); ```
赞
0
收藏
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
登录
后参与评论
评论
还没有评论!