CI_Output::_display()

_display([$output = ''])

Parameters:
  • $output (string) – Output data override
Returns:

void

Return type:

void

Sends finalized output data to the browser along with any server headers. It also stops benchmark timers.

Note

This method is called automatically at the end of script execution, you won’t need to call it manually unless you are aborting script execution using exit() or die() in your code.

Example:

$response = array('status' => 'OK');

$this->output
        ->set_status_header(200)
        ->set_content_type('application/json', 'utf-8')
        ->set_output(json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES))
        ->_display();
exit;

Note

Calling this method manually without aborting script execution will result in duplicated output.

doc_CodeIgniter
2016-10-15 16:31:49
Comments
Leave a Comment

Please login to continue.