OpenSwoole\Http\Request->header

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

Declaration

<?php OpenSwoole\Http\Request->header

Parameters

None

Return

Array

Description

The OpenSwoole\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(OpenSwoole\Server\Request $request, OpenSwoole\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 September 20, 2022