Ubah hala - Laravel 5.2 Sesi hilang selepas perisian tengah diubah hala untuk mengesahkan tamat masa log masuk?
过去多啦不再A梦
过去多啦不再A梦 2017-05-16 16:51:22
0
1
1113

pemegang fungsi awam($permintaan, Penutupan $seterusnya, $penjaga = 'pengurus')

{ if (!Auth::guard($guard)->check()) { return redirect('manager/login'); } if (config('misc.session_timeout_status')) { $isLoggedIn = $request->path() != '/manager/logout'; if (!session('lastActivityTime')) { $this->session->put('lastActivityTime', time()); } elseif (time() - $this->session->get('lastActivityTime') > $this->timeout) { debugbar()->info('时间到!'.$this->timeout); log::info('时间到!'.$this->timeout); $this->session->forget('lastActivityTime'); $cookie = cookie('intend', $isLoggedIn ? url()->current() : 'manager/'); $email = Auth::guard($guard)->user()->email; session()->flash('flash_danger', '您自动登出是出于安全原因,因为您' . $this->timeout / 60 . '分钟内没有活动。'); Auth::guard($guard)->logout(); return redirect()->to('/manager/login')->withErrors('您自动登出是出于安全原因,因为您' . $this->timeout / 60 . '分钟内没有活动。')->withInput(compact('email'))->withCookie($cookie); } $isLoggedIn ? $this->session->put('lastActivityTime', time()) : $this->session->forget('lastActivityTime'); } return $next($request); } redirect后session或error都没值了,login接收不到数据,路由如下:

Laluan::kumpulan(['ruang nama' => 'Pengurus', 'awalan' => 'pengurus'], fungsi () {

Route::auth(); Route::group([ 'middleware' => ['admin'], ], function () { Route::get('/', 'HomeController@index'); Route::resource('article', 'ArticleController'); });

});

不知道哪里出问题了。
过去多啦不再A梦
过去多啦不再A梦

membalas semua (1)
Peter_Zhu

Komponen tengah 'middleware' => ['admin'], disebabkan

    Muat turun terkini
    Lagi>
    kesan web
    Kod sumber laman web
    Bahan laman web
    Templat hujung hadapan
    Tentang kita Penafian Sitemap
    Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!