swoole http server 的request中有哪些东西呢?

$http = new Swoole\Http\Server('0.0.0.0', 9501);

$http->on('Request', function ($request, $response) use ($http) {
    /**
     * swoole http 服务的 request 中 有那些东西
     * fd 客户端口唯一标识
     * header 请求头信息
     * server 对应 php $_SERVER
     * cookie 信息 php $_COOKIE
     * get 对应 php $_GET
     * post 对应 Php $_POST
     * files 对应 php $_FILES
     * tmpfiles  $_FILES 的部分数据
     */

    echo json_encode($request) . PHP_EOL;

});

输出结果:

{
    "fd": 1,
    "header": {
        "user-agent": "PostmanRuntime\/7.28.0",
        "accept": "*\/*",
        "postman-token": "7fde4ecd-f7fd-414f-8fe2-d45f538bae67",
        "host": "localhost:9501",
        "accept-encoding": "gzip, deflate, br",
        "connection": "keep-alive",
        "content-type": "multipart\/form-data; boundary=--------------------------070893652364061875063737",
        "content-length": "12927"
    },
    "server": {
        "request_method": "POST",
        "request_uri": "\/",
        "path_info": "\/",
        "request_time": 1627442507,
        "request_time_float": 1627442507.04809,
        "server_protocol": "HTTP\/1.1",
        "server_port": 9501,
        "remote_port": 63532,
        "remote_addr": "127.0.0.1",
        "master_time": 1627442506
    },
    "cookie": null,
    "get": null,
    "files": {
        "file": {
            "name": "LOGO108\u00d7108.jpg",
            "type": "image\/jpeg",
            "tmp_name": "\/tmp\/swoole.upfile.Tg2oqu",
            "error": 0,
            "size": 12713
        }
    },
    "post": null,
    "tmpfiles": [
        "\/tmp\/swoole.upfile.Tg2oqu"
    ]
}

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值