$http = new swoole_http_server("0.0.0.0", 9502); | |
$http->on("request", function ($request, $response){ | |
$response->end("11111"); | |
}); | |
$http->start(); |
因为是http,所以要用curl
$http = new swoole_http_server("0.0.0.0", 9502); | |
$http->on("request", function ($request, $response){ | |
print_r($request->get); | |
$response->end("11111"); | |
}); | |
$http->start(); |
就会打印到黑窗口上
$http = new swoole_http_server("0.0.0.0", 9502); | |
$http->on("request", function ($request, $response){ | |
// print_r($request->get); | |
$response->end("11111". json_encode($request->get)); | |
}); | |
$http->start(); |
$http = new swoole_http_server("0.0.0.0", 9502); | |
$http->on("request", function ($request, $response){ | |
// print_r($request->get); | |
$response->cookie('malina', 'aaa', 1800); | |
$response->end("11111". json_encode($request->get)); | |
}); | |
$http->start(); |
指定静态资源目录
$http->set([ | |
'enable_static_handler' => true, | |
'document_root' => '/home/malina/project/swoole/static' | |
]); |