laravel 5.7.15 419 抱歉,您的会话已过期。请刷新并重试
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/53609222/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
laravel 5.7.15 419 Sorry, your session has expired. Please refresh and try again
提问by Ijaz Ahmed Bhatti
Hello i am using laravel 5.7.15
i am facing issue
您好,我正在使用 laravel 5.7.15 我遇到了问题
<form method="post" action="my_post_Action" class="login100-form validate-form">
<input type="hidden" name="_token" value="B6et9cJOP5wNKodCPgCbAafDjpA5EMcRaaJhEJ9F">
<span class="login100-form-title">
Admin Login
</span>
<div class="wrap-input100 validate-input" data-validate="Valid email is required: [email protected]">
<input class="input100" type="text" name="email" placeholder="Email">
<span class="focus-input100"></span>
<span class="symbol-input100">
<i class="fa fa-envelope" aria-hidden="true"></i>
</span>
</div>
<div class="wrap-input100 validate-input" data-validate="Password is required">
<input class="input100" type="password" name="password" placeholder="Password">
<span class="focus-input100"></span>
<span class="symbol-input100">
<i class="fa fa-lock" aria-hidden="true"></i>
</span>
</div>
<div class="container-login100-form-btn">
<button class="login100-form-btn">
Login
</button>
</div>
</form>
here is my code
i don't know whats error
it my login route if i comment csrf
verification form kernal.php
then session not work
Any Help thanks in advance ..
这是我的代码我不知道我的登录路径有什么错误如果我评论csrf
验证表单kernal.php
然后会话不起作用任何帮助提前致谢..
采纳答案by Ijaz Ahmed Bhatti
I do not really got the issue I have tried every solution but i have to install new Laravel and have to move all my Controllers, Routes, And views manually to get rid of the issue Really thanks to all of you guys:)
我并没有真正解决这个问题,我已经尝试了所有解决方案,但我必须安装新的 Laravel,并且必须手动移动我所有的控制器、路由和视图以解决这个问题真的感谢你们所有人:)
回答by Diogo Santo
Make sure you hard refresh the page; Clear the cache as well by doing:
php artisan cache:clear
Make sure you have the right permissions for your logs folder:
chmod -R 755 storage/logs
Make sure to generate a key for your application:
php artisan key:generate
Check if, when using post and CSRFyou have the
web
middleware group wrapping your routes;
确保你硬刷新页面;通过执行以下操作清除缓存:
php artisan 缓存:清除
确保您对日志文件夹具有正确的权限:
chmod -R 755 存储/日志
确保为您的应用程序生成一个密钥:
php工匠密钥:生成
检查在使用 post 和CSRF 时是否有
web
中间件组包装你的路由;
I solved mine with that! Hope it helps! :D
我用那个解决了我的!希望能帮助到你!:D
回答by Ryuujo
Try to put @csrf
in bottom of <form>
tag
尝试放在标签的@csrf
底部<form>
回答by MD. Jubair Mizan
It's one time only? Just delete the folder storage/framework/cache/data
是不是只有一次?删除文件夹storage/framework/cache/data
回答by Péter
You have to set chmod
to 757
for ./storage/framework/sessions
also.
It helps for me and it works fine now, without error 419
.
你必须设置chmod
到757
了./storage/framework/sessions
也。它对我有帮助,现在工作正常,没有错误419
。
回答by Péter
Anytime you define an HTML form in your application, you should include a hidden CSRF token field in the form so that the CSRF protection middleware can validate the request.
Try @csrf
after tag.
任何时候在应用程序中定义 HTML 表单时,都应该在表单中包含一个隐藏的 CSRF 令牌字段,以便 CSRF 保护中间件可以验证请求。@csrf
标记后尝试。
回答by Sultanos
Just in case of dispair and when no other solution Works , you can add your page name here to a White list to the pages that will not be checked with CSRF.
以防万一,当没有其他解决方案有效时,您可以将您的页面名称添加到白名单中,这些页面将不会被 CSRF 检查。
Needless to say , is a must to remember that with this you are removing this security check , use it wisely and at your own criteria
毋庸置疑,必须记住,通过此操作,您将删除此安全检查,请根据您自己的标准明智地使用它。
you can find it here : app/Http/Middleware/VerifyCsrfToken.php
你可以在这里找到它:app/Http/Middleware/VerifyCsrfToken.php
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'/nameofpagetobeexcluded','/anotherpagetobeexcludedfromthischeck'
];
回答by Arshad Jilani
Make sure you have added @csrfOR {{ csrf_field() }}in your form.
确保您在表单中添加了@csrf或{{ csrf_field() }}。
<form method="post" action="{{ url('your route here') }}">
@csrf
</form>