'CODEIGNITER 3: save a whole page response to a file before sending it to client browser

I want to save a page to a file in CODEIGNITER 3 - a whole page just before the page is sent to a browser. But I don't know how to do it and the most important is where to process the page in Codeigniter 3 code?



Solution 1:[1]

Oh, I was lucky to find it somehow in my code:

https://codeigniter.com/userguide3/general/hooks.html?highlight=display_override

display_override Overrides the _display() method, used to send the finalized page to the web browser at the end of system execution. This permits you to use your own display methodology. Note that you will need to reference the CI superobject with $this->CI =& get_instance() and then the finalized data will be available by calling $this->CI->output->get_output().

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dejan Dozet