【发布时间】:2018-02-20 13:11:35
【问题描述】:
我是 Laravel 的新手,我正在使用 Laravel 5.5。
当我在没有{{ csrf_field() }} 的情况下提交时
在验证 csrf 令牌中没有收到错误令牌不匹配异常
错误是
页面由于不活动而过期。 请刷新并重试
我的 HTML 表单是
<form method="POST" action="/post">
<div class="form-group">
<label for="title">Title</label>
<input type="text" class="form-control" name="title">
</div>
<div class="form-group">
<label for="textblog">Body</label>
<input type="textarea" class="form-control" name="body">
</div>
<button type="submit" class="btn btn-primary">Publish</button>
</form>
我的路线网页文件
Route::post('/post','PostsController@store');
这是我的控制器类函数
public function store() {
dd(request()->all());
}
【问题讨论】:
-
@ShaunakShukla 感谢您的编辑
-
@Don'tPanic 我尝试了 chrome 和 firfox 我得到了相同的响应
标签: php forms laravel csrf laravel-5.5