CodeIgniter Forums
Trouble outputting text in CodeIgniter 2.x? - 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: Trouble outputting text in CodeIgniter 2.x? (/showthread.php?tid=87406)



Trouble outputting text in CodeIgniter 2.x? - HarengaWoltrkr - 04-17-2023

How can I output text in real-time using CodeIgniter 2.x? I have tried using ob_end_flush() and flush() functions along with increasing the number of bytes, but the output is still not displayed until the script is finished. I have also tried the following code:

scss

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();
}
But the output is not displayed until after 6 seconds. How can I make the script output the text in real-time, waiting for 3 seconds after each echo statement? Any help would be appreciated.