我正在用 codeigniter 做项目。我的登录页面已成功执行。登录后我想重定向到 home.php 页面。我的登录代码只是成功执行,重定向方法有问题。我也提供了我的目录结构供引用。
代码:
public function processlogin()
{
// $this->load->model('login_model');
// $show =true;
// $user = $this->login_model->showUser($show);
$username = $this->input->post('user_name');
$password = $this->input->post('password');
{
$this->load->model('login_model');
$this->load->database();
$query = $this->db->get_where('tbllogin', array('login_name' => $username,'password' => $password));
$count1 = count($query->result());
if($count1 === 1)
{
$this->load->helper('url');
redirect('login_page/home');
}
else
{
echo 'Error';
}
}
}
现在请告诉我应该将重定向文件放在哪里。
最佳答案
public function processlogin()
{
// $this->load->model('login_model');
// $show =true;
// $user = $this->login_model->showUser($show);
$username = $this->input->post('user_name');
$password = $this->input->post('password');
{
$this->load->model('login_model');
$this->load->database();
$query = $this->db->get_where('tbllogin', array('login_name' => $username,'password' => $password));
$count1 = count($query->result());
if($count1 === 1)
{
$this->load->helper('url');
$this->load->view('login_page/home');
}
else
{
echo 'Error';
}
}
}
关于php - 在codeigniter中登录后将重定向文件放在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21111557/