laravel 5.8.7 页面已过期 (419)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/55327542/
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.8.7 Page expired (419)
提问by Omar Saleem
I am submitting a POST request from form and it shows 419 | page expired.
我正在从表单提交 POST 请求,它显示 419 | 页面已过期。
Blade.php:
刀片.php:
<form action="<?php echo action('TestsController@store'); ?>" method="post">
Route:
路线:
Route::resource('tests', 'TestsController');
Controller:
控制器:
public function store(Request $request) {
echo "something something";
}
回答by Levente Otta
Laravel has built-in CSRF protection. Check out the official documentacion.
Laravel 具有内置的 CSRF 保护。查看官方文档。
Add @csrf
to you form.
添加@csrf
到您的表单中。
<form action="<?php echo action('TestsController@store'); ?>" method="post">
@csrf
</form>
回答by Nikolay
回答by Shahadat Sunny
In my case, I have solved the problem by setting SSL for my domain. I've tried all the solution, but they didn't work. Then I set the SSL for the domain and it solved the problem.
就我而言,我通过为我的域设置 SSL 解决了这个问题。我已经尝试了所有的解决方案,但没有奏效。然后我为域设置了 SSL 并解决了问题。