CI_Output::set_profiler_sections()

set_profiler_sections($sections) Parameters: $sections (array) – Profiler sections Returns: CI_Output instance (method chaining) Return type: CI_Output Permits you to enable/disable specific sections of the Profiler when it is enabled. Please refer to the Profiler documentation for further information.

CI_Output::set_output()

set_output($output) Parameters: $output (string) – String to set the output to Returns: CI_Output instance (method chaining) Return type: CI_Output Permits you to manually set the final output string. Usage example: $this->output->set_output($data); Important If you do set your output manually, it must be the last thing done in the function you call it from. For example, if you build a page in one of your controller methods, don’t set the output until the end.

CI_Output::set_header()

set_header($header[, $replace = TRUE]) Parameters: $header (string) – HTTP response header $replace (bool) – Whether to replace the old header value, if it is already set Returns: CI_Output instance (method chaining) Return type: CI_Output Permits you to manually set server headers, which the output class will send for you when outputting the final rendered display. Example: $this->output->set_header('HTTP/1.0 200 OK'); $this->output->set_header('HTTP/1.1 200 OK'); $thi

CI_Output::set_content_type()

set_content_type($mime_type[, $charset = NULL]) Parameters: $mime_type (string) – MIME Type idenitifer string $charset (string) – Character set Returns: CI_Output instance (method chaining) Return type: CI_Output Permits you to set the mime-type of your page so you can serve JSON data, JPEG’s, XML, etc easily. $this->output ->set_content_type('application/json') ->set_output(json_encode(array('foo' => 'bar'))); $this->output ->set_content_

CI_Output::get_output()

get_output() Returns: Output string Return type: string Permits you to manually retrieve any output that has been sent for storage in the output class. Usage example: $string = $this->output->get_output(); Note that data will only be retrievable from this function if it has been previously sent to the output class by one of the CodeIgniter functions like $this->load->view().

CI_Output::get_header()

get_header($header) Parameters: $header (string) – HTTP header name Returns: HTTP response header or NULL if not found Return type: mixed Returns the requested HTTP header value, or NULL if the requested header is not set. Example: $this->output->set_content_type('text/plain', 'UTF-8'); echo $this->output->get_header('content-type'); // Outputs: text/plain; charset=utf-8 Note The header name is compared in a case-insensitive manner. Note Raw headers sent via PHP’s na

CI_Output::get_content_type()

get_content_type() Returns: Content-Type string Return type: string Returns the Content-Type HTTP header that’s currently in use, excluding the character set value. $mime = $this->output->get_content_type(); Note If not set, the default return value is ‘text/html’.

CI_Output::enable_profiler()

enable_profiler([$val = TRUE]) Parameters: $val (bool) – Whether to enable or disable the Profiler Returns: CI_Output instance (method chaining) Return type: CI_Output Permits you to enable/disable the Profiler, which will display benchmark and other data at the bottom of your pages for debugging and optimization purposes. To enable the profiler place the following line anywhere within your Controller methods: $this->output->enable_profiler(TRUE); When enabled a report will b

CI_Output::cache()

cache($time) Parameters: $time (int) – Cache expiration time in minutes Returns: CI_Output instance (method chaining) Return type: CI_Output Caches the current page for the specified amount of minutes. For more information, please see the caching documentation.

CI_Output::append_output()

append_output($output) Parameters: $output (string) – Additional output data to append Returns: CI_Output instance (method chaining) Return type: CI_Output Appends data onto the output string. $this->output->append_output($data);