### Single header
header('Location', 'http://example.com');
### Multiple headers
header(['Location' => 'http://example.com', 'X-Extra' => 'My header']);
### String header
header('WWW-Authenticate: Negotiate');
### Array of string headers
header(['WWW-Authenticate: Negotiate', 'Content-type: application/pdf']);
Multiple calls for setting the same header name will have the same effect as setting the header once
with the last value sent for it
header('WWW-Authenticate: Negotiate');
header('WWW-Authenticate: Not-Negotiate');
will have the same effect as only doing
header('WWW-Authenticate: Not-Negotiate');
public header ( string | array | null $header = null, string | array | null $value = null ) : array | ||
$header | string | array | null | An array of header strings or a single header string - an associative array of "header name" => "header value" is also accepted - an array of string headers is also accepted |
$value | string | array | null | The header value(s) |
return | array | List of headers to be sent |