Created
May 31, 2018 14:11
-
-
Save ezimuel/c2613f771c415678dc50d1d1930585cd to your computer and use it in GitHub Desktop.
Simple Hello World! HTTP server in PHP with Swoole
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$http = new swoole_http_server("127.0.0.1", 9501); | |
$http->on("start", function ($server) { | |
var_dump($server); | |
echo "Swoole http server is started at http://127.0.0.1:9501\n"; | |
}); | |
$http->on("request", function ($request, $response) { | |
var_dump($request); | |
$response->header("Content-Type", "text/plain"); | |
$response->end("Hello World!\n"); | |
}); | |
$http->start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment