WP_REST_Server::get_headers( array $server )
Extracts headers from a PHP-style $_SERVER array.
Description Description
Parameters Parameters
- $server
-
(array) (Required) Associative array similar to
$_SERVER
.
Return Return
(array) Headers extracted from the input.
Source Source
File: wp-includes/rest-api/class-wp-rest-server.php
public function get_headers( $server ) { $headers = array(); // CONTENT_* headers are not prefixed with HTTP_. $additional = array( 'CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true, ); foreach ( $server as $key => $value ) { if ( strpos( $key, 'HTTP_' ) === 0 ) { $headers[ substr( $key, 5 ) ] = $value; } elseif ( isset( $additional[ $key ] ) ) { $headers[ $key ] = $value; } } return $headers; }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |