sonill Posted July 5, 2009 Share Posted July 5, 2009 can anyone tell me how to use output buffer in php? why is output buffer used and does it help in speeding the code processing speed and web page loading. I hope someone might help Link to comment https://forums.phpfreaks.com/topic/164814-output-buffer/ Share on other sites More sharing options...
trq Posted July 5, 2009 Share Posted July 5, 2009 Its covered thoroughly within the manual. why is output buffer used It has allot of different uses, most notably probably in template engine development. and does it help in speeding the code processing speed and web page loading. Generally, no. It would have the opposite effect. Link to comment https://forums.phpfreaks.com/topic/164814-output-buffer/#findComment-869085 Share on other sites More sharing options...
haku Posted July 5, 2009 Share Posted July 5, 2009 Very rarely do people use it for the right reasons. Most of the time people use it to mask bad programming logic, when they are getting header errors from outputting data to the browser before setting a header or a cookie. One good use of output_buffer is to cache static pages to speed up loading times. You put everything in the output buffer, then create an HTML file with the contents. Then each time the page is loaded, you check to see if anything new has been added to the page since the last html page was created. If nothing new has been added, you output the html page, if it has, you create a new html page, and output that. It adds a slight bit of processing time to the first person to access a page after the data has been changed, but speeds up all subsequent load times until the next time something new is added to the page. Link to comment https://forums.phpfreaks.com/topic/164814-output-buffer/#findComment-869138 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.