Swoole\Http\Request->header

Latest version: pecl install openswoole-4.11.1

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 March 31, 2022