我想知道如果有人能让我知道他们如何处理CodeIgniter中的成功/失败消息。CodeIgniter - 显示成功或不成功的消息
例如,当用户登录到我的网站,这是林目前做在控制器中会发生什么
if (!is_null($data = $this->auth->create_user($this->form_validation->set_value('username'), $this->form_validation->set_value('password')))) {
// Redirect to the successful controller
redirect('create-profile/successful');
} else {
// Redirect to the unsuccessful controller
redirect('create-profile/unsuccessful');
}
然后在同一个控制器(创建姿态),我有2个这是像下面这样的
function successful()
{
$data['h1title'] = 'Successful Registration';
$data['subtext'] = '<p>Test to go here</p>';
// Load the message page
$this->load->view('message',$data);
}
该问题的方法是,我可以简单地去site.com/create-profile/successful,它会显示该页面。
如果有人可能会告诉我一个更好的方式来处理这个,它将不胜感激。
干杯,
考虑使用闪光灯会话数据。只要检测到会话数据,打印警报或成功消息就会更加高效,而不是为每次成功/失败都创建单独的页面。 – user482594