Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2009
    Posts
    75
    Thanks
    1
    Thanked 12 Times in 12 Posts

    Outputting and ending buffer early

    I would like a php script to submit it's output to the browser and continue to run code. For example:
    PHP Code:
    <?php
    echo "This is my output";
    ob_end_flush(); //The browser has completely loaded the page
    sleep(100);
    //work goes here
    ?>
    With the above script, from the browser's point of view, the page will have loaded instantly with the words "This is my output" and not for 100 seconds. The script however will continue to run code without any dependence on the browser's connection.

    ob_end_flush() did not work as I wanted it to, I don't know if that's even it's intended purpose. How can I go about doing this?

  • #2
    New Coder
    Join Date
    Jan 2006
    Posts
    73
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Look at the responses at PHP's documentation page on the sleep page: http://php.net/manual/en/function.sleep.php. From what I can infer it is browser dependent and can have problems with flushing output.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •