note 76880 added to function.ob-get-length
| From: | stangelanda at arrowquick dot com | Date: | Fri, 03 Aug 2007 15:36:23 +0000 |
| Subject: | note 76880 added to function.ob-get-length | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129151@lists.php.net to get a copy of this message | ||
If you don't buffer your output, it doesn't seem like it would be possible for a web
server to output a Content-Length header. For static files it can check the filesize, but for
dynamic files that send output a little by little there is no way to know how many bytes it is going
to output. And the headers have to be sent before a single byte is output.
Also if you're wondering why the Content-Length is important, the browser doesn't close
the connection as long as the script is running. So if you register time consuming shutdown
functions, the browser will still 'spin' waiting for more content until they complete.
(I'm not sure this happens under all conditions, but I am certain the sending the
Content-Length always prevents this.)
You might take note that this manual page does not currently output any Content-Length header.
Alternatively using mb_strlen($output, 'latin1') seems to work to determine bytes in a
string. strlen may or may not depending on if it has been set up as a multibyte or not.
----
Server IP: 64.71.164.2
Probable Submitter: 207.32.22.145
----
Manual Page -- http://www.php.net/manual/en/function.ob-get-length.php
Edit -- https://master.php.net/note/edit/76880
Del: integrated -- https://master.php.net/note/delete/76880/integrated
Del: useless -- https://master.php.net/note/delete/76880/useless
Del: bad code -- https://master.php.net/note/delete/76880/bad+code
Del: spam -- https://master.php.net/note/delete/76880/spam
Del: non-english -- https://master.php.net/note/delete/76880/non-english
Del: in docs -- https://master.php.net/note/delete/76880/in+docs
Del: other reasons-- https://master.php.net/note/delete/76880
Reject -- https://master.php.net/note/reject/76880
Search -- https://master.php.net/manage/user-notes.php