set_header() public method

Lets you set a server header which will be sent with the final output. Note: If a file is cached, headers will not be sent.
public set_header ( string $header, boolean $replace = TRUE ) : CI_Output
$header string Header
$replace boolean Whether to replace the old header value, if already set
return CI_Output
 /**
  * Set Header
  *
  * Lets you set a server header which will be outputted with the final display.
  *
  * @access	public
  * @param	string
  * @return	void
  */
 function set_header($header, $replace = TRUE)
 {
     $EE =& get_instance();
     // We always need to send a content type
     if ($EE->config->item('send_headers') != 'y' && strncasecmp($header, 'content-type', 12) != 0) {
         return;
     }
     parent::set_header($header, $replace);
 }
示例#2
0
 function send_png_header(CI_Output $output)
 {
     //header('Content-type: text/css');
     $header = 'Content-type: image/png';
     $output->set_header($header, TRUE);
 }