2017-01-05 2 views
0

현재 Ion Auth와 함께 Codeigniter 3.1.2를 사용하고 있습니다. 로그인하고 내 대시 보드 페이지를 볼 수는 있지만 고객 페이지와 같이 사용자가 로그인해야하는 다른 페이지를 보려고하면 항상 로그인 페이지로 리디렉션됩니다.Ion Auth + Codeigniter logged_in은 항상 로그인으로 리디렉션됩니다.

컨트롤러

public function __construct(){ 
    parent::__construct(); 
    $this->load->library('form_validation'); 
    $this->load->library('session'); 
    $this->load->helper('form'); 
    $this->load->helper('url'); 
    $this->load->model('CRUD'); 

    if (!$this->ion_auth->logged_in()) { 
     redirect('User/index'); 
    } 
} 

public function index(){ 
    $this->load->helper('form'); 
    $this->load->view('login'); 
} 

public function dashboard(){ 
    $this->load->view('dashboard'); 
} 

public function customerPage(){ 
    $data['customer'] = $this->CRUD->getCustomers(); 
    $this->load->view('customer', $data);   
} 

public function materialPage(){ 
    $data['material'] = $this->CRUD->getMaterials(); 
    $this->load->view('material', $data); 

} 

감사합니다, CHTRK

답변

0
public function __construct(){ 
parent::__construct(); 
$this->load->library('form_validation'); 
$this->load->library('session'); 
$this->load->helper('form'); 
$this->load->helper('url'); 
$this->load->model('CRUD'); 

if (!$this->ion_auth->logged_in()) { 
    redirect('User/index'); 
} 

"! $ this-> ion_auth-> logged_in()"그 때마다 실행되므로 생성자 외부에서이를 사용합니다. 메소드에서 매번 호출 할 다른 메소드를 작성해야합니다. 색인 용으로 사용하지 마십시오.