note 93441 added to features.connection-handling

From: Date: Thu, 10 Sep 2009 06:43:21 +0000
Subject: note 93441 added to features.connection-handling
Groups: php.notes 
Request: Send a blank email to php-notes+get-160397@lists.php.net to get a copy of this message
hey, thanks to arr1, and it is very useful for me, when I need to return to the user fast and then do something else. When using the codes, it nearly drive me mad and I found another thing that may affect the codes: Content-Encoding: gzip This is because the zlib is on and the content will be compressed. But this will not output the buffer until all output is over. So, it may need to send the header to prevent this problem. now, the code becomes: <?php ob_end_clean(); header("Connection: close\r\n"); header("Content-Encoding: none\r\n"); ignore_user_abort(true); // optional ob_start(); echo ('Text user will see'); $size = ob_get_length(); header("Content-Length: $size"); ob_end_flush(); // Strange behaviour, will not work flush(); // Unless both are called ! ob_end_clean(); //do processing here sleep(5); echo('Text user will never see'); //do some processing ?> ---- Server IP: 69.147.83.197 Probable Submitter: 124.205.129.100 ---- Manual Page -- http://www.php.net/manual/en/features.connection-handling.php Edit -- https://master.php.net/note/edit/93441 Del: integrated -- https://master.php.net/note/delete/93441/integrated Del: useless -- https://master.php.net/note/delete/93441/useless Del: bad code -- https://master.php.net/note/delete/93441/bad+code Del: spam -- https://master.php.net/note/delete/93441/spam Del: non-english -- https://master.php.net/note/delete/93441/non-english Del: in docs -- https://master.php.net/note/delete/93441/in+docs Del: other reasons-- https://master.php.net/note/delete/93441 Reject -- https://master.php.net/note/reject/93441 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#160397) next »