CodeIgniter Forums
Codeigniter 2.x - Echo output as script is working - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 2.x (https://forum.codeigniter.com/forumdisplay.php?fid=18)
+--- Thread: Codeigniter 2.x - Echo output as script is working (/showthread.php?tid=84801)



Codeigniter 2.x - Echo output as script is working - MurbiesWalto - 11-11-2022

I was trying to get codeigniter to output text as the script was working but couldn't get it to work. I have search on here and google and seen using ob_end_flush(); and flush(); and also along with adding more bytes so the browser can output. But none of that is working in CI 2.x. If anyone has had luck with this, thanks in advance


I have tried

function test()
{
    ob_end_flush();
        echo "test1";
    ob_start();
    sleep(3);
    ob_end_flush();
        echo "test1";
    ob_start();
    sleep(3);
    ob_end_flush();
        echo "test1";
    ob_start();
}
With no luck. The script waits 6 seconds then spits everything out at once. I would like it to echo the output to the screen then wait 3 seconds then output the next echo echatspin echatrandom then wait another 3 seconds etc.