Home >Backend Development >PHP Tutorial >一个捕获函数输出的函数_php模板

一个捕获函数输出的函数_php模板

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-17 09:41:161135browse

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

复制代码 代码如下:

  
/**  
  * 捕获一个函数的输出  
  * example:get_output(array($this,'test'));  
*/  
function get_output($array)  
{  
   ob_start();  
   call_user_func($array);  
   return ob_get_clean();  
}  
?>  
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn