swoole_http_server客户端测试

测试方法:

http_server.php 文件内容

<?php
// use Swoole\Http\Server;
// $http = new Server("0.0.0.0",9501); 实例化例子

$http = new swoole_http_server("0.0.0.0",8811);
$http->on('request', function ($request, $response) {
    $response->end("<h1>Hello Swoole. #".rand(1000, 9999)."</h1>");
});
$http->start();

在linux 环境下运行 curl http://127.0.0.1:8811  ip加端口号

获取到服务器 响应给客户端的数据

还有一种用服务器域名访问

猜你喜欢

转载自www.cnblogs.com/kevin-yang123/p/10059065.html