I use phpdocx
library to make reports in Word. By default, download
function contains these lines:
$this->save($tmp_filename);
... many headers
ob_clean();
flush();
readfile($tmp_filename);
exit;
With ob_clean
function nothing happens - nothing is loaded. If I comment out this line, then the file starts to load. But it gets loaded with an error, which appears when I try to open the file. The error message says that the file is corrupt etc. However, if I open the temporary file itself - it is ok. So, what I want to know is what can be wrong with ob_clean
function and with the download function on the whole.
EDIT
I replaced ob_clean
with ob_end_clean
and the problem has gone away.