php - 在codeigniter中登录后将重定向文件放在哪里?

标签 php codeigniter redirect authentication

我正在用 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';
            }
        }
    }

enter image description here

现在请告诉我应该将重定向文件放在哪里。

最佳答案

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/

相关文章:

php - WooCommerce 附加信息 - 如果为空,则隐藏

php - htaccess 中主机名的重定向规则

退出时的 Javascript 确认框

php - 在 SQL 中删除行 1-150934

php - 转换为小写并连接

php - 为什么MySQLI INSERT不起作用?

php - 如何禁用 Codeigniter 中的日志记录?

php - CodeIgniter if...else 语句未正确执行

php - mysql 和 codeigniter 的奇怪插入行为

redirect - 如何重新加载我的页面以重定向到 VAADIN 中的 URI 片段?