路线: Route::resource('tests', 'TestsCon-6ren">
gpt4 book ai didi

php - laravel 5.8.7 页面已过期 (419)

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:34:17 32 4
gpt4 key购买 nike

我正在从表单提交 POST 请求,它显示 419 |页面已过期。

Blade .php:

<form action="<?php echo action('TestsController@store'); ?>" method="post">

路线:

Route::resource('tests', 'TestsController');

Controller :

public function store(Request $request) {
echo "something something";
}

最佳答案

Laravel 具有内置的 CSRF 保护。 Check out the official documentacion.

@csrf 添加到您的表单中。

<form action="<?php echo action('TestsController@store'); ?>" method="post">
@csrf
</form>

关于php - laravel 5.8.7 页面已过期 (419),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55327542/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com