我有这段代码
/*===================================================
= This block can't be changed =
===================================================*/
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/footer.tpl')) {
$this->template = $this->config->get('config_template') . '/template/common/footer.tpl';
} else {
$this->template = 'default/template/common/footer.tpl';
}
$this->render(); // need to have same effect of "return $this->render();"
/*===== End of This block can't be changed ======*/
并编写了另一种处理render方法的方法:
protected function render()
{
return $this->load->view($this->template, $this->data);
}
当调用方法render假定渲染方法返回相同时,我需要这样做。
" $这 - >渲染();"需要具有相同的效果"返回$ this-> render();"
任何?
答案 0 :(得分:0)
尝试输出缓冲。
http://php.net/manual/en/book.outcontrol.php
http://php.net/manual/en/outcontrol.examples.basic.php
ob_start();
$this->render();
$buffer = ob_get_flush();