<?php
$http = new swoole_http_server('0.0.0.0', 9501);

$http->set([
    'enable_static_handler' => true,
    'document_root' => '/root/'
]);
$http->on('request', function ($request, $response) {
    $response->header('Content-Type', 'text/html; charset=utf-8');
    $response->end('<h1>Hello Swoole. #' . rand(1000, 9999) . '</h1>');
});

$http->start();

 

可以像node一样轻松调试程序了

相关文章:

  • 2021-11-15
  • 2021-08-01
  • 2022-01-02
  • 2021-10-26
  • 2021-10-12
  • 2021-12-28
猜你喜欢
  • 2022-02-06
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
相关资源
相似解决方案