We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Output buffer?

So, how to clean output from phalcon.

Tried all ob_* functions = nothing. Tried flush(); - nothing.

Suggestions?

try ob_flush() , but after line where you are outputting content



9.3k
edited Jun '14

Still nothing. Even if I'm doing like:

ob_start(); echo 123; ob_flush();

it still prints 123. Is phalcon using other output buffering?

yes, output buffering is enabled by default ... are you having problem to output something or to not output ? maybe i didnt understand you well



9.3k

I`ve problems disabling output. Tried to disable it everywhere, starting from controllers till views, and index.php, but still phalcon generates output...

Output buffers can be nested so try:

while (ob_get_level()) ob_end_flush();

I just had the same problem. It looks like Phalcon flushes the current output buffer level and creates it's own when starting the dispatch loop. This looks strange, but it works for me:

ob_start();
ob_start();
<do you stuff>
ob_end_clean();
$output = ob_get_clean();

Best Fabian