|
发表于 2012-9-3 09:29:23
|
显示全部楼层
本帖最后由 feizhoulv 于 2012-9-3 09:35 编辑
楼上的很正确,如果想传递一个页面可以附加第三个参数。
用法:
$data['content'] = $this->load->view('mycontent', array(), true);
$this->load->view('mypage', $data);
函数原型
// --------------------------------------------------------------------
/**
* Load View
*
* This function is used to load a "view" file. It has three parameters:
*
* 1. The name of the "view" file to be included.
* 2. An associative array of data to be extracted for use in the view.
* 3. TRUE/FALSE - whether to return the data or load it. In
* some cases it's advantageous to be able to return data so that
* a developer can process it in some way.
*
* @param string
* @param array
* @param bool
* @return void
*/
public function view($view, $vars = array(), $return = FALSE)
{
return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
}
|
|