Laravel 5.5 The page has expired due to inactivity error while sending form

こ雲淡風輕ζ 提交于 2019-12-02 08:10:53

问题


I'am using laravel 5.5 and it gives me that "The page has expired due to inactivity. Please refresh and try again." This is awkward because I never encounter this error. Same codes but different laravel version..

My form;

{!! Form::open(['url'=>'admin/save-social']) !!}
{{ Form::label('pinterest', 'Pinterest;', ['class' => 'control-label']) }}
{{ Form::text('pinterest', null, ['class' => 'form-control'])}}
{{ Form::label('linkedn', 'Linkedn;', ['class' => 'control-label'])}}
{{ Form::text('linkedn', null, ['class' => 'form-control'])}}
{{ Form::label('facebook', 'Facebook;', ['class' => 'control-label']) }}
{{ Form::text('facebook', null, ['class' => 'form-control']) }}
{{ Form::label('twitter', 'Twitter;', ['class' => 'control-label']) }}
{{ Form::text('twitter', null, ['class' => 'form-control']) }}
{{ Form::label('instagram', 'İnstagram;', ['class' => 'control-label']) }}
{{ Form::text('instagram', null, ['class' => 'form-control']) }}
{{ Form::submit('Save', ['class'=>'btn btn-success btn-lg btn-block']) }}
{!! Form::close()!!}

And config/session.php

<?php

return [
    'driver' => env('SESSION_DRIVER', 'file'),
    'lifetime' => 120,
    'expire_on_close' => false,
    'encrypt' => false,
    'files' => storage_path('framework/sessions'),
    'connection' => null,
    'table' => 'sessions',
    'store' => null,
    'lottery' => [2, 100],
    'cookie' => env(
        'SESSION_COOKIE',
        str_slug(env('APP_NAME', 'laravel'), '_').'_session'
    ),
    'path' => '/',
    'domain' => env('SESSION_DOMAIN', null),
    'secure' => env('SESSION_SECURE_COOKIE', false),
    'http_only' => true,
    'same_site' => null,
];

回答1:


Since these commands has solved your problem in the comments i should write it as an answer . Try these commands and start your form again

 php artisan cache:clear
 php artisan config:clear 
 php artisan route:clear 
 php artisan view:clear



回答2:


I assume that you are using laravel collective for forms builder.

Probably your issue is associate with CSRF Protection (https://laravelcollective.com/docs/master/html#csrf-protection).

Please check the above link and ensure that you include CSRF based on method or explicit Form::token();




回答3:


Another point is that Laravelcollective maybe not is available for laravel 5.5. You can check this issue from GitHub and find a workaround for collective in Laravel 5.5 https://github.com/LaravelCollective/html/issues/364




回答4:


Try out the following statements:

php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear

It worked for me. Enjoy



来源:https://stackoverflow.com/questions/46551940/laravel-5-5-the-page-has-expired-due-to-inactivity-error-while-sending-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!