正在显示
1 个修改的文件
包含
0 行增加
和
5 行删除
| @@ -12,11 +12,6 @@ class SimpleServer | @@ -12,11 +12,6 @@ class SimpleServer | ||
| 12 | $this->httpServer = new Server($host, $port); | 12 | $this->httpServer = new Server($host, $port); |
| 13 | } | 13 | } |
| 14 | public function router($url, $callback){ | 14 | public function router($url, $callback){ |
| 15 | - $this->httpServer->on($url, function ($request, $response) use ($callback){ | ||
| 16 | - $response->header("Content-Type", "text/plain"); | ||
| 17 | - $content = call_user_func($callback); | ||
| 18 | - $response->end("Hello World\n"); | ||
| 19 | - }); | ||
| 20 | $this->httpServer->on('Request', function (Request $request, Response $response) use ($url, $callback){ | 15 | $this->httpServer->on('Request', function (Request $request, Response $response) use ($url, $callback){ |
| 21 | $requestInfo = [ | 16 | $requestInfo = [ |
| 22 | 'path' => $request->server['path_info'], | 17 | 'path' => $request->server['path_info'], |
-
请 注册 或 登录 后发表评论