控制器:
$data = array(
'error_message' => 'Invalid Username or Password'
);
$this->load->view('/login/index', $data);
查看页面:
<?php echo $error_message; ?>
答案 0 :(得分:0)
我猜您已将view
路径设置错误,因此变量未到达view
。
这是应该的,
控制器:(applications / controllers / filename.php)
$data = array(
'error_message' => 'Invalid Username or Password'
);
$this->load->view('login/index', $data); # removed slash here
查看:(applications / views / login / index.php)
<?php echo $error_message; ?>