I just wrote a simple function to capture the output of any function. It is also a core of the general template system.
Copy the code The code is as follows:
/**
* Capture the output of a function
* example:get_output(array($this,'test'));
*/
function get_output($array)
{
ob_start();
call_user_func($array );
return ob_get_clean ();
}
?>
The above introduces a function that captures function output, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.