Swoole\Http\Request->header

4.x is outdated, please check the latest version 22.x


Latest version: pecl install openswoole-22.1.2

Declaration

<?php Swoole\Http\Request->header

Parameters

None

Return

Array

Description

The Swoole\Http\Request->header is an array which contains the information of HTTP request headers that were sent.

All the array keys are lowercase.

Example

<?php

$server->on('Request', function(Swoole/Server/Request $request, Swoole/Server/Response $response)
{
    // Array keys are lowercase
    echo $request->header['host'];
    echo $request->header['accept-language'];

    // See the whole request headers array
    var_dump($request->header);
});
Last updated on August 31, 2022