9951 explained code solutions for 126 technologies


php-swooleHTTP request get query string


$http = new Swoole\HTTP\Server('127.0.0.1', 81);
$http->on('Request', function($req, $res) { echo $req->get['id'] . "\n"; });
$http->start();ctrl + c
$http

creates HTTP server

on('Request'

do something when we got request from client

$req

Swoole HTTP Request object to operate on request

$req->get['id']

output id param from query string of client request right into server output