【发布时间】:2015-06-22 01:29:03
【问题描述】:
我正在尝试使用 curl post 方法提交表单。我已将 csrf 令牌正确设置为表单。
<form action="{{URL::route('the-route')}}" method="post"><input name="_token" type="hidden" value="{{csrf_token()}}">
但它在VerifyCsrfToken.php line 46: 中显示TokenMismatchException。我被困在使用共享主机上,我将我的larvel 5 项目包含在myapp 文件夹和laravel public 文件夹在public_html 中
作为测试,我也尝试过其他一些帖子建议注释掉
App\Http\Middleware\VerifyCsrfToken,在app/Http/kernal.php
看看会发生什么。每次提交表单后,我都会收到一条消息,指出重定向到:/auth/login 或 /auth/register,具体取决于我来自哪里,但没有成功。
【问题讨论】:
-
您好,您能否通过使用调试器或使用 dd() 转储变量来验证您的令牌是否与
Illuminate\Foundation\Http\Middleware\VerifyCsrfToken中的tokensMatch($request)匹配?