简体   繁体   English

VerifyCsrfToken.php 53行中的TokenMismatchException(Laravel)

[英]TokenMismatchException in VerifyCsrfToken.php line 53 (Laravel)

I read some questions about this problem, and I use this input in my form: 我阅读了有关此问题的一些问题,并在表单中使用了此输入:

 <input type="hidden" name="_token" value="{{ csrf_token() }}">

But this not works, when I send my form the TokenMismatchException appears in my screen. 但这不起作用,当我发送表单时,TokenMismatchException出现在屏幕上。

This is my complete form, I don´t want use web controllers to post, I want post in self file. 这是我完整的表格,我不想使用Web控制器发布,我想发布在自我文件中。

<form method="POST" action="order.php" id="formcontacto">
                        <textarea name="mensaje" id="mensaje"></textarea>
                        <input type="hidden" name="FUNCTION" id="FUNCTION" value="creaincid" />
                        <button id="btn-enviar" class="btn" type="button" onclick="envia();">Enviar</button>
                        <input type="hidden" name="next_url" value="{{ $_SERVER['SERVER_PROTOCOL'] .'://'.$_SERVER['HTTP_HOST'] .'?'.$_SERVER['QUERY_STRING'] }}">
                        <input type="hidden" name="_token" value="{{ csrf_token() }}">
                    </form>

I have encountered this myself and is normally something quite simple that has been over looked. 我本人也遇到过这种情况,通常看起来很简单。

First off if you are using a blade template try adding to your template 首先,如果您使用的是刀片模板,请尝试添加到模板中

{{ csrf_field() }}

More information - http://laravel.com/docs/master/routing 详细信息-http://laravel.com/docs/master/routing

This can also be an issue with with config/session.php check there isn't an issue with the domain entered here. config / session.php也可能是一个问题,请检查此处输入的域是否存在问题。

If neither of these address the issue you may need to create a middleware 如果这些都不解决问题,则您可能需要创建一个中间件

An excellent answer can be found here: Laravel 5 TokenMismatchException on PHP 5.6.9 一个很好的答案可以在这里找到: PHP 5.6.9上的Laravel 5 TokenMismatchException

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Laravel 5中VerifyCsrfToken.php第53行中的TokenMismatchException - TokenMismatchException in VerifyCsrfToken.php line 53 in Laravel 5 laravel 5.1中的“ VerifyCsrfToken.php 53行中的TokenMismatchException:” - “TokenMismatchException in VerifyCsrfToken.php line 53:” in laravel 5.1 VerifyCsrfToken.php第53行中的Laravel 5-TokenMismatchException:SOS呼叫 - Laravel 5-TokenMismatchException in VerifyCsrfToken.php line 53: SOS CALL Laravel 5.1 中 VerifyCsrfToken.php 第 53 行中的 TokenMismatchException - TokenMismatchException in VerifyCsrfToken.php line 53 in Laravel 5.1 实时服务器 Laravel 5.1 上 VerifyCsrfToken.php 第 53 行中的 TokenMismatchException - TokenMismatchException in VerifyCsrfToken.php line 53 on Live server Laravel 5.1 VerifyCsrfToken.php第53行中的TokenMismatchException:laravel 5.1中的(Firefox浏览器)? - TokenMismatchException in VerifyCsrfToken.php line 53:(Firefox browser) in laravel 5.1? VerifyCsrfToken.php第53行中的laravel 5.1错误TokenMismatchException: - laravel 5.1 error TokenMismatchException in VerifyCsrfToken.php line 53: VerifyCsrfToken.php第53行中的TokenMismatchException:生产 - TokenMismatchException in VerifyCsrfToken.php line 53: production VerifyCsrfToken.php第53行中的TokenMismatchException: - TokenMismatchException in VerifyCsrfToken.php line 53: VerifyCsrfToken.php第46行中的Laravel 5 TokenMismatchException - Laravel 5 TokenMismatchException in VerifyCsrfToken.php line 46
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM