Php 如何在laravel 5.0中获得另一个页面会话值?
我已经在Php 如何在laravel 5.0中获得另一个页面会话值?,php,session,laravel,laravel-5,Php,Session,Laravel,Laravel 5,我已经在AuthenticatesAndRegistersUsers.php文件中设置了会话变量,这个值是使用session:all()laravel默认函数在我的控制器中获得的 因此,它不是在该控制器上显示,而是在AuthenticatesAndRegistersUsers.php页面上显示 以下是我的AuthenticatesAndRegistersUsers.php页面代码: use Session ; ...... if ($this->auth->
AuthenticatesAndRegistersUsers.php
文件中设置了会话变量,这个值是使用session:all()
laravel默认函数在我的控制器中获得的
因此,它不是在该控制器上显示,而是在AuthenticatesAndRegistersUsers.php
页面上显示
以下是我的AuthenticatesAndRegistersUsers.php页面代码:
use Session ;
......
if ($this->auth->attempt($credentials, $request->has('remember')))
{
session()->regenerate();
Sesstion::put('admin','admin');
session(['key' => 'value']);
return redirect()->intended($this->redirectPath());
}
return redirect($this->loginPath())
->withInput($request->only('email', 'remember'))
->withErrors([
'email' => $this->getFailedLoginMessage(),
]);
......
下面是我的控制器代码
use Session;
..........
public function index()
{
session()->regenerate();
dd(Session::all());exit;
return view('/admin/index');
}
.......
删除
session()->重新生成()代码>来自控制器代码某段时间,它会导致FatalErrorException类“Illumb\Foundation\Auth\Sesstion”未找到,这是因为会话拼写错误。这不是会话,有时最好仔细阅读错误。就像达芬奇密码一样,解决方案也在谜题中:)@AndreiP。只是打字错误,还是不行