MediaWiki  1.23.2
WebResponse Class Reference

Allow programs to request this object from WebRequest::response() and handle all outputting (or lack of outputting) via it. More...

Inheritance diagram for WebResponse:

Public Member Functions

 header ( $string, $replace=true, $http_response_code=null)
 Output a HTTP header, wrapper for PHP's header() More...
 
 setcookie ( $name, $value, $expire=0, $options=null)
 Set the browser cookie. More...
 

Detailed Description

Allow programs to request this object from WebRequest::response() and handle all outputting (or lack of outputting) via it.

Definition at line 28 of file WebResponse.php.

Member Function Documentation

◆ header()

WebResponse::header (   $string,
  $replace = true,
  $http_response_code = null 
)

Output a HTTP header, wrapper for PHP's header()

Parameters
string$stringheader to output
bool$replacereplace current similar header
null | int$http_response_codeForces the HTTP response code to the specified value.

Reimplemented in FauxResponse.

Definition at line 36 of file WebResponse.php.

◆ setcookie()

WebResponse::setcookie (   $name,
  $value,
  $expire = 0,
  $options = null 
)

Set the browser cookie.

Parameters
string$namename of cookie
string$valuevalue to give cookie
int | null$expireUnix timestamp (in seconds) when the cookie should expire. 0 (the default) causes it to expire $wgCookieExpiration seconds from now. null causes it to be a session cookie.
array$optionsAssoc of additional cookie options: prefix: string, name prefix ($wgCookiePrefix) domain: string, cookie domain ($wgCookieDomain) path: string, cookie path ($wgCookiePath) secure: bool, secure attribute ($wgCookieSecure) httpOnly: bool, httpOnly attribute ($wgCookieHttpOnly) raw: bool, if true uses PHP's setrawcookie() instead of setcookie() For backwards compatability, if $options is not an array then it and the following two parameters will be interpreted as values for 'prefix', 'domain', and 'secure'
Since
1.22 Replaced $prefix, $domain, and $forceSecure with $options

Reimplemented in FauxResponse.

Definition at line 59 of file WebResponse.php.

References $name, $options, $value, $wgCookiePrefix, array(), global, wfDebugLog(), and wfRunHooks().


The documentation for this class was generated from the following file: