Swoole\Http\Response->header

Declaration

<?php
Swoole\Http\Response->header(string $key, string $value)

Parameters

key

The key of HTTP header

value

The value of HTTP header

Return

Response

Description

Set the HTTP header sending to HTTP client.

This method must be called before the $response->end method.

Example

$response->header('Content-Type', 'image/jpeg');