Jump to content

Output buffer not working


terryds

Recommended Posts

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 by terryds
Link to comment
Share on other sites

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 by terryds
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...