Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-18-2010, 05:34 PM   PM User | #1
TheBlueblib
New Coder

 
Join Date: May 2009
Posts: 74
Thanks: 1
Thanked 12 Times in 12 Posts
TheBlueblib is an unknown quantity at this point
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?
TheBlueblib is offline   Reply With Quote
Old 06-19-2010, 09:26 AM   PM User | #2
xGIHavoc
New Coder

 
Join Date: Jan 2006
Posts: 73
Thanks: 2
Thanked 3 Times in 3 Posts
xGIHavoc is an unknown quantity at this point
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.
xGIHavoc is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:24 AM.


Advertisement
Log in to turn off these ads.