Amiro.CMS API Reference
Amiro.Ru / Manual
Loading search...

The AMI_HTTPResponse class

• Introduction

HTTP response.

• Class synopsis

AMI_HTTPResponse {
/* Methods */
// Adds/replaces HTTP header.
public addHeader ( string $string, [ bool $bReplace = true ], [ int $code = null ] ) returns AMI_HTTPResponse;
// Returns server protocol.
public getProtocol ( ) returns string;
// Sets HTTP content type.
public setContentType ( string $type ) returns AMI_HTTPResponse;
// Sets a cookie.
public setCookie ( string $name, string $value, [ string $expire = FALSE ], [ string $path = FALSE ] ) returns AMI_HTTPResponse;
// Sends redirect header for HTML response mode.
public setRedirect ( string $location, [ int $code = 302 ] ) returns this;
}

• Class Methods

// Adds/replaces HTTP header.
public addHeader ( string $string, [ bool $bReplace = true ], [ int $code = null ] ) returns AMI_HTTPResponse;
  • string $string
    HTTP header
  • bool $bReplace
    Indicates whether the header should replace a previous similar header, or add a second header of the same type
  • int $code
    Forces the HTTP response code to the specified value
  Example:
Tags:
link php:header()
// Returns server protocol.
public getProtocol ( ) returns string;
// Sets HTTP content type.
public setContentType ( string $type ) returns AMI_HTTPResponse;
  • string $type
    HTTP contetnt type
  Example:
// Sets a cookie.
public setCookie ( string $name, string $value, [ string $expire = FALSE ], [ string $path = FALSE ] ) returns AMI_HTTPResponse;
  • string $name
    Cookie name
  • string $value
    Cookie value
  • string $expire
    Cookie expiration date (Unix timestamp)
  • string $path
    Cookie save path
Tags:
since 5.12.4
// Sends redirect header for HTML response mode.
public setRedirect ( string $location, [ int $code = 302 ] ) returns this;
  • string $location
    Redirect location
  • int $code
    Redirect code