2014-11-24 3 views

답변

0

대신 쿼리 문자열에서 리디렉션 URL을 저장, 당신은 같은 세션에 저장할 수 :

$_SESSION['login-redirect'] = '/some-path.php' 

를 그리고, 당신은 단지 다음과 같이 재 지정할 수 있습니다 :

$loginRedirectUrl = '/default-path.php' 
if (isset($_SESSION['login-redirect'])) $loginRedirectUrl = $_SESSION['login-redirect']; 
header('Location: '.$loginRedirectUrl); 
+0

나는 이것에서 약간의 개념을 얻었다. 나는 코드 점화 장치에 내 대답을 쓸 것이다. – user254153

+0

나는 이것에서 약간의 개념을 얻었다. 나는 코드 점화 장치에 내 대답을 쓸 것이다. – user254153

+0

이것이 도움이된다면 답안을 수락 된 것으로 표시 할 수 있습니까? http://i.stack.imgur.com/uqJeW.png –

0

컨트롤러에서 :

public function product() 
{ 
    if ($this->session->userdata('logged_in')) { 
     $data["refined_product_category"] = $this->cmsdbmodel->refined_product(); 
     $this->load->view('cms/header'); 

     $this->load->view('cms/products',$data); 
     $this->load->view('cms/footer'); 
    } 
    else { 
     $url = current_url(); //gets your current url. 
     $this->session->set_userdata("sess_url", $url); //keeps your current url in session. 
     $this->index(); 
    } 
} 

로그인 페이지에 있습니다.

public function login() 
{ 
    if (login success) { 
     redirect($this->session->userdata("sess_url")); //retrieve the url that was in session and redirect. 
    } 
} 

나는 이것을했고 그것은 나를 위해 일했다.

관련 문제