note 92000 deleted from function.register-shutdown-function by danbrown
| From: | danbrown@php.net | Date: | Sat, 04 Jul 2009 15:17:35 +0000 |
| Subject: | note 92000 deleted from function.register-shutdown-function by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157910@lists.php.net to get a copy of this message | ||
Note Submitter: Sina Salek
----
"...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