swoole web服务
web.php
<?php $http = new swoole_http_server("0.0.0.0", 9501); $http->on('request', function ($request, $response) { var_dump($request->get, $request->post); $response->header("Content-Type", "text/html; charset=utf-8"); $response->end("<h1>Hello Swoole. #".rand(1000, 9999)."</h1>"); }); $http->start();
效果如下
http访问:http://192.168.204.130:9501/?dds=333 即可访问,服务器端可以获取dds参数值