static_handler.php 357 B

1234567891011121314
  1. <?php
  2. $http = new Swoole\Http\Server("0.0.0.0", 9501, SWOOLE_BASE);
  3. //$http = new swoole_http_server("0.0.0.0", 9501);
  4. $http->set([
  5. 'enable_static_handler' => true,
  6. 'http_autoindex' => true,
  7. 'document_root' => realpath(__DIR__.'/../www/'),
  8. ]);
  9. $http->on('request', function ($req, $resp) {
  10. $resp->end("hello world\n");
  11. });
  12. $http->start();