首页 > 解决方案 > 页面没有重定向到 URL?

问题描述

我正在做PHP-CodeIgniter项目。我正在使用ION Auth library身份验证。

我的问题是当我将粘贴表数据复制到 Excel 工作表,然后单击复制到 Excel 的链接not properly redirect到特定页面时。如果我hover mouse on the link it shows proper address,但在点击它时,它redirects to Dashboard不是particular page,它们是一个Active session data,但它只重定向到仪表板。

控制器代码:

<?php (defined('BASEPATH')) OR exit('No direct script access allowed');

class Auth extends CI_Controller
{

function __construct()
{
    parent::__construct();
    // $this->load->library('');
    $this->load->model('Landlord_m', 'l');

}

public function index()
{
    redirect('auth/login');
}

public function login()
{
    if( $this->ion_auth->logged_in() ) redirect('dashboard');

    $this->form_validation->set_rules('email', 'email', 'required|valid_email|trim');
    $this->form_validation->set_rules('password', 'password', 'required|trim');

    $this->form_validation->set_message('required', 'Please enter your %s');

    //  Validate form
    if( $this->form_validation->run() )
    {
        $remember   =   (bool) $this->input->post('remember');

        //  Check login
        if( $this->ion_auth->login($this->input->post('email'), $this->input->post('password'), $remember) )
        {
            //  Login was successful
            redirect('dashboard', 'refresh');
        }
        else
        {
            //  Login was un-successful
            $this->session->set_flashdata('message', $this->ion_auth->errors());
            redirect('auth/login', 'refresh');
        }
    }
    else
    {
        $data['message']    =   $this->session->flashdata('message');

        $this->load->view('auth/login', $data);
    }
}

public function logout()
{
    if( $this->ion_auth->logout() )
        redirect('auth/login');
    else
        die("There was an error logging you out");
}

欢迎任何形式的帮助,在此先感谢。

标签: phpcodeigniter-3ion-auth

解决方案


推荐阅读