1.在/web/tool/demo/server下新建http_server.php
```
<?php
$http = new swoole_http_server("0.0.0.0", 9503);
$http->on('request', function($request, $response) {
$response->cookie("singwa", "xsssss", time() + 1800);
//$response->end("<h1>hello world!</h1>");
$response->end("sss". json_encode($request->get));
});
$http->start();
```
2.可以在终端用命令验证
```
curl http://127.0.0.1:9503
```
![](https://img.kancloud.cn/d6/15/d6153449358af00508449add73c8724e_659x50.png)
3.或者浏览器输入验证
![](https://img.kancloud.cn/6d/4e/6d4ec402dc906f6c926bdcf3688c2ddd_817x178.png)
![](https://img.kancloud.cn/a5/84/a584f10d30694ea5ee8d3e9d8a0003f4_1811x644.png)