我在控制器中使用以下代码。但是 data['msg'] 没有被传递给视图文件。
代码:
class Operator{
public function view ($page)
{
if ( ! file_exists('application/views/pages/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
show_404();
}
$data['title'] = $this->getTitle($page);
$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);
}
public function create_company()
{
// some code
$data['msg1']='my mesg';
redirect('operator/view/operator_success','refresh');
}
};
加载 operator_success(view page) 时显示错误消息:未定义变量“$msg1”。