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

WBOY
Release: 2016-05-17 09:41:16
Original
1062 people have browsed it

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

复制代码 代码如下:

  
/**  
  * 捕获一个函数的输出  
  * example:get_output(array($this,'test'));  
*/  
function get_output($array)  
{  
   ob_start();  
   call_user_func($array);  
   return ob_get_clean();  
}  
?>  
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!