terryds Posted November 4, 2013 Share Posted November 4, 2013 (edited) Here is my code <?php ob_start();?><!DOCTYPE html><html><head><title>Output Buffering</title></head><body><p>I'm the first to load</p><?php ob_flush();sleep(2) ?><p>I'm the second to load after 2s</p><?php ob_end_flush();sleep(2); ?></body></html> When i load the page, the two paragraph loads at the same time... What i want is that the first paragraph come first, and right after 2 secs, the second paragraph appears.. Can you tell me how to fix that? Edited November 4, 2013 by terryds Link to comment Share on other sites More sharing options...
justsomeguy Posted November 4, 2013 Share Posted November 4, 2013 Telling PHP to sleep causes the response to be delayed. If you want content to appear dynamically then use Javascript to do that timing. Link to comment Share on other sites More sharing options...
terryds Posted November 5, 2013 Author Share Posted November 5, 2013 (edited) Actually, i want to make an upload loading page.. So, i want the notice like 'Please wait, your file is being sent to the server', then after the upload finishes loading, it will say 'Your file has been uploaded'.. Can you tell me how to make it ? It uses output buffering,right? Edited November 5, 2013 by terryds Link to comment Share on other sites More sharing options...
Ingolme Posted November 5, 2013 Share Posted November 5, 2013 PHP isn't the right language to do that. People make those interfaces with Javascript. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now