TokenMismatchException in VerifyCsrfToken.php line 67:
in VerifyCsrfToken.php line 67
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 726
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699
at Router->dispatchToRoute(object(Request)) in Router.php line 675
at Router->dispatch(object(Request)) in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 54
at require_once('C:\xampp\htdocs\coparmex\public\index.php') in server.php line 21
私はこの問題を1週間のように解決しようとしていました!私は5回ごとに1つの形式で情報を送信します。これは私がshureしているものです。VerifyCsrfToken.phpのTokenMismatchException行67:Laravel 5.2
- 私は方法で
{!! Form:: !!}
タグを使用している投稿したり、置く、それが自動的に{!! csrf_token() !!}
を生成し、それはそれをしない私は、ページのコード - を見れば、私はそれを確認することができない私は
<meta name="csrf-token" content="{{ csrf_token() }}"/>
を持っていますメインレイアウト - の中でメタトークンは、フォーム
- イムでのトークンが、私はnavigaorクッキーをきれいに
.env
でファイルドライバCACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync
を使用していることと同じである- 私はこれらのコマンドを使用している
Auth::guard($guard)->check()
- とコントローラのミドルウェアを使用しています:
php artisan cache:clear, composer dump-autoload, php artisan clear-compiled
これは私がとのセッションを開始する場合、私は、警備員を使用していますlogingフォーム
{!! Form::open(['route'=>'log.store', 'method'=>'POST']) !!}
{!!Form::text('user',null,array('placeholder' => 'User'))!!}
{!!Form::password('password',array('placeholder' => 'Password'))!!}<br>
{!!Form::select('type', [
'A' => 'A',
'E' => 'E',
])!!}
{!!Form::submit('Login',['class'=>'button'])!!}
{!!Form::close()!!}
の一例ですウェブガード、それはうまく動作し、エラーは表示されないので、私はそれが私の警備員と間違いでなければならないと思う。これらは私のガードです:
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'user2' => [
'driver' => 'session',
'provider' => 'users2',
],
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
],
],
これらは私のプロバイダ
'providers' => [
'admins' => [
'driver' => 'eloquent',
'model' => App\Admin::class,
],
'users2' => [
'driver' => 'eloquent',
'model' => App\User2::class,
],
'users' => [
'driver' => 'eloquent',
'model' => BolsaDeTrabajo\User::class,
],
],
ですこれは私が
セッションを開始する方法ですif($request['type'] == 'A'){
if (Auth::guard('user2')->attempt([
'user' => $request['user'],
'password' => $request['password']
], true)) {
return Redirect::to('/');
}else{
return Redirect::to('/')->with('message', 'error');
}
}else{
if (Auth::guard('admin')->attempt([
'user' => $request['user'],
'password' => $request['password']
], true)) {
return Redirect::to('/');
}else{
return Redirect::to('/')->with('message', 'error');
}
}
これは私のauth.php
return [
'driver' => env('SESSION_DRIVER', 'file'),
'lifetime' => 120,
'expire_on_close' => false,
'encrypt' => false,
'files' => storage_path('framework/sessions'),
'connection' => null,
'table' => 'sessions',
'lottery' => [2, 100],
'cookie' => 'laravel_session',
'path' => '/',
'domain' => env('SESSION_DOMAIN', null),
'secure' => false,
'http_only' => true,
];
システムのインスタンスを複数使用していますか?たとえば、localhost:80、localhost:81またはリモートホストの場合(例:123.123.123.123:80? – Laerte
いいえ、それは常にlocalhostです:8000 – Saucyloco
'config/session.php'でセッション' lifetime'をチェックすると、おそらく短すぎますか? – yazfield