note 92000 added to function.register-shutdown-function
| From: | SinaSalek at osu1 dot php dot net | Date: | Sat, 04 Jul 2009 11:11:37 +0000 |
| Subject: | note 92000 added to function.register-shutdown-function | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-157906@lists.php.net to get a copy of this message | ||
"...The shutdown functions are called as the part of the request so that it's possible to
send the output from them. There is currently no way to process the data with output buffering
functions in the shutdown function..."
It means that we can't clear output using it in PHP4 but there is a workaround by using
ob_start callback function.
<?php
class Test {
var $_php4OutputBuffer='';
function Test() {
ob_start(array(&$this,'outputBufferCallback'));
register_shutdown_function(array(&$this,'parseOutput'));
}
function outputBufferCallback($output) {
$this->_php4OutputBuffer.=$output;
return '';
}
function parseOutput() {
echo $this->_php4OutputBuffer;//Now we can't modify the output and then send it to the
browser
}
}
$test=new Test();
?>
Hope it helps
sina.salek.ws
----
Server IP: 69.147.83.197
Probable Submitter: 84.47.225.66
----
Manual Page -- http://www.php.net/manual/en/function.register-shutdown-function.php
Edit -- https://master.php.net/note/edit/92000
Del: integrated -- https://master.php.net/note/delete/92000/integrated
Del: useless -- https://master.php.net/note/delete/92000/useless
Del: bad code -- https://master.php.net/note/delete/92000/bad+code
Del: spam -- https://master.php.net/note/delete/92000/spam
Del: non-english -- https://master.php.net/note/delete/92000/non-english
Del: in docs -- https://master.php.net/note/delete/92000/in+docs
Del: other reasons-- https://master.php.net/note/delete/92000
Reject -- https://master.php.net/note/reject/92000
Search -- https://master.php.net/manage/user-notes.php