视图模板要先定义加载:
正确写法:
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');
}