php获取print的内容,放入变量

时间:2014-03-20 01:20:05   收藏:0   阅读:489

可以参考drupal的theme_render_template函数

function theme_render_template($template_file, $variables) {
  // Extract the variables to a local namespace
  extract($variables, EXTR_SKIP);

  // Start output buffering
  ob_start();

  // Include the template file
  include DRUPAL_ROOT . ‘/‘ . $template_file;

  // End buffering and return its contents
  return ob_get_clean();
}

 

主要用到2个函数,ob_start和ob_get_clean

php获取print的内容,放入变量,布布扣,bubuko.com

原文:http://www.cnblogs.com/merryfreespace/p/3612530.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!