表單提交數據報錯。
為什么我在表單里輸入數據后,點擊提交,結果報錯了呢?Whoops, looks like something went wrong. TokenMismatchException in VerifyCsrfToken.php line 46:
為什么我在表單里輸入數據后,點擊提交,結果報錯了呢?Whoops, looks like something went wrong. TokenMismatchException in VerifyCsrfToken.php line 46:
2016-10-12
舉報
2018-10-26
你也可以通過將這類 URI 添加到?
VerifyCsrfToken
?中間件中的?$except
?屬性來排除對這類路由的 CSRF 保護:2017-02-13
弱弱的問一句具體加在哪里。
2016-10-12
解決了,要在表單域里加? ?<input type="hidden" name="_token" value="{{csrf_token()}}"/> 原因是:
laravel 默認開啟了 csrf驗證 ,不是get請求的話需要驗證csrf,因此在表單里需要加個隱藏域 ?