Skip to main content
Version: Fegg 5.x (next)

Application::setHtmlHeader

Send an HTTP response header

Description​

public void Application::setHtmlHeader( string $header )

Sends an HTTP response header (it calls PHP's header()). Call it before the page is output, for example before Application::displayPage.

Arguments​

NameData typeDefaultRemarks
$headerstringHeader line, such as Content-Type: application/json

Example​

Controller
$this->setHtmlHeader('Content-Type: text/javascript; charset=UTF-8');
echo $this->fetchPage('data/config_js');

Sends the Content-Type: text/javascript; charset=UTF-8 header, then outputs the template.