note 111619 added to function.ob-flush

From: Date: Fri, 08 Mar 2013 20:30:02 +0000
Subject: note 111619 added to function.ob-flush
Groups: php.notes 
Request: Send a blank email to php-notes+get-194002@lists.php.net to get a copy of this message
Currently I have Chrome on OS X Snow Leopard updating a page as it is sent more data, BUT it only does this after I send it <body> along with 1013 more characters (making 1019 total characters). After it receives this it immediately displays it and then displays anything else as it is received. (Note that this browser-operating system combination isn't necessarily the only one, it's just the only one I've tested.) In order to do this using php, I've done nothing but send ob_flush() after each echo or print. I can also make it happen without ob_flush() by calling ob_implicit_flush(), then ob_end_flush() before print, and then it updates with each print after that. I have pretty typical settings and I change none of them when the file runs, it literally looks like this: <?php ob_implicit_flush(); ob_end_flush(); ?><body>[1013 more characters]<?php for ($i = 1; $i < 30000000; ++$i) {} echo "something that didn't show up immediately"; ?> (Ok, the "[1013 more characters]" part wasn't strictly literal.) If you want just text in the browser, you do this before everything else: <?php header("Content-type: text/plain"); ... ?> Then it won't care whether you sent a body tag, it will just wait for 1019 characters. ---- Server IP: 69.147.83.199 Probable Submitter: 71.192.26.224 ---- Manual Page -- http://php.net/manual/en/function.ob-flush.php Edit -- https://master.php.net/note/edit/111619 Del: integrated -- https://master.php.net/note/delete/111619/integrated Del: useless -- https://master.php.net/note/delete/111619/useless Del: bad code -- https://master.php.net/note/delete/111619/bad+code Del: spam -- https://master.php.net/note/delete/111619/spam Del: non-english -- https://master.php.net/note/delete/111619/non-english Del: in docs -- https://master.php.net/note/delete/111619/in+docs Del: other reasons-- https://master.php.net/note/delete/111619 Reject -- https://master.php.net/note/reject/111619 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#194002) next »