<?php
$http = new swoole_http_server("0.0.0.0", 9512);
$http->on("start", function ($server) {
echo "Swoole http server is started at http://127.0.0.1:9512\n";
});
$http->on("request", function (\swoole_http_request $request, \swoole_http_response $response) {
static $a= 0;
$aPP;
$response->write("a:".$a.PHP_EOL);
});
$http->start();
browser request http://127.0.0.1:9512
first output
second output
third output
fourth output
Environment:
| PHP | 7.1.15 |
| Swoole | 4.0.0 |
| Laravel Framework | 5.5.26