WP_HTTP_Response::__construct() WordPress Method
The WP_HTTP_Response::__construct() function is used to construct an HTTP response object. This function takes two arguments: a code and an array of headers. The code argument is the HTTP response code, while the array of headers is an associative array of header names and values.
WP_HTTP_Response::__construct( mixed $data = null, int $status = 200, array $headers = array() ) #
Constructor.
Parameters
- $data
(mixed)(Optional)Response data.
Default value: null
- $status
(int)(Optional) HTTP status code.
Default value: 200
- $headers
(array)(Optional) HTTP header map.
Default value: array()
Source
File: wp-includes/class-wp-http-response.php
public function __construct( $data = null, $status = 200, $headers = array() ) { $this->set_data( $data ); $this->set_status( $status ); $this->set_headers( $headers ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |