当前位置:主页 > 软件编程 > PHP代码 >

一个捕获函数输出的函数

时间:2021-03-31 09:13:19 | 栏目:PHP代码 | 点击:

刚写的一个简单函数,用来捕获任意一个函数的输出。也是一般模版系统的一个核心吧。
复制代码 代码如下:

<?  
/**  
  * 捕获一个函数的输出  
  * example:get_output(array($this,'test'));  
*/  
function get_output($array)  
{  
   ob_start();  
   call_user_func($array);  
   return ob_get_clean();  
}  
?>  

您可能感兴趣的文章:

相关文章