您的位置:首页 > 其它

kohana视图view加载顺序 先加载模板 再定义变量

2013-12-09 10:56 225 查看
视图模板要先定义加载:正确写法:
	public function action_index()
{
$this->template = View::factory('welcome');
$this->template->a = '<br>aaaaaaaaaaaaaaaaaa<br>';
$this->template->b = '<br>bbbbbbbbbbbbbbbbbbbbbbbbb<br>';
}

错误写法(这样变量a,b是无法读取到的):
	public function action_index()
{
$this->template->a = '<br>aaaaaaaaaaaaaaaaaa<br>';
$this->template->b = '<br>bbbbbbbbbbbbbbbbbbbbbbbbb<br>'; $this->template = View::factory('welcome');
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: