2016-06-30 47 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