一个捕获函数输出的函数
更新时间:2007年02月14日 00:00:00 作者:
刚写的一个简单函数,用来捕获任意一个函数的输出。也是一般模版系统的一个核心吧。
<?
/**
* 捕获一个函数的输出
* example:get_output(array($this,'test'));
*/
function get_output($array)
{
ob_start();
call_user_func($array);
return ob_get_clean();
}
?>
复制代码 代码如下:
<?
/**
* 捕获一个函数的输出
* example:get_output(array($this,'test'));
*/
function get_output($array)
{
ob_start();
call_user_func($array);
return ob_get_clean();
}
?>
相关文章
在PHP模板引擎smarty生成随机数的方法和math函数详解
如果要在smarty模板中生成随机数,该如何办呢?在php文件中生成然后赋值到模板中。2014-04-04


最新评论