视图和渲染之间有什么区别? [英] What is the difference between view and render?
本文介绍了视图和渲染之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Codeigniter中查看和渲染之间有什么区别?
What is the difference between view and render in codeigniter?
推荐答案
某些模板库使用 $ this-> template-> render();
根据您的模板输出渲染的内容.(您必须明显安装了模板库)
some template libraries use $this->template->render();
to output the rendered content based on your template. (you must have the template library installed obviously)
function index()
{
$this->template->set_template('main_template');
$data['content'] = 'hello this is my content';
$this->template->write_view('content', $data);
$this->template->render();
}
实际上与
function index()
{
$data['content'] = 'hello this is my content';
$this->load->view('template/header');
$this->load->view('template/content', $data);
$this->load->view('template/footer');
}
模板库省去了每次加载每个局部视图的需要.
template libraries save the need to load each partial view every time.
这篇关于视图和渲染之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文