2016-06-30 45 views
1

我的網站昨晚工作。但在早上當我嘗試登錄和登錄工作,但我的session值不顯示在另一個控制器。會話重定向laravel 4.2後會自動銷燬

這裏是我的代碼示例,

我有這樣的路線,

Route::get('/', array('before' => 'detectLang','uses' => '[email protected]')); 
Route::get('{slug}', 'Des[email protected]'); 

//DesignerController 
public function getClient() 
{ 
    Session::put('client', 'test'); // after login auth i am putting this 
    //print_r(Session::get('client')); exit; //this one working here 
    return Redirect::to('/'); // then redirecting to another controller 
} 


//ProductController 
public function getIndex() 
{ 
    print_r(Session::get('client')); exit; 
} 

但是,這顯示什麼。不知道是什麼導致問題。

回答

-1

你可以通過創建一個構造函數並從那裏初始化會話來解決這個問題。

+0

Laravel自動啓動會話,沒有必要這樣做,這不會解決問題。 – TheFallen