PHP Class JBZoo\Utils\Http

Show file Open project: jbzoo/utils Class Usage Examples

Public Methods

Method Description
download ( string $filename ) : boolean Transmit headers that force a browser to display the download file dialog.
getHeaders ( ) : array Get all HTTP headers
nocache ( ) : boolean Sets the headers to prevent caching for the different browsers.
utf8 ( string $content_type = 'text/html' ) : boolean Transmit UTF-8 content headers if the headers haven't already been sent.

Method Details

download() public static method

Cross browser compatible. Only fires if headers have not already been sent.
public static download ( string $filename ) : boolean
$filename string The name of the filename to display to browsers
return boolean

getHeaders() public static method

Get all HTTP headers
See also: https://github.com/symfony/http-foundation/blob/master/ServerBag.php
public static getHeaders ( ) : array
return array

nocache() public static method

Different browsers support different nocache headers, so several headers must be sent so that all of them get the point that no caching should occur
public static nocache ( ) : boolean
return boolean

utf8() public static method

Transmit UTF-8 content headers if the headers haven't already been sent.
public static utf8 ( string $content_type = 'text/html' ) : boolean
$content_type string The content type to send out
return boolean