[英]Method 'POST' error 419 on local server Laravel
当我在我的页面上提交一个帖子表单时它不起作用,它会将我重定向到错误 419 的操作路线上,这是我的表单示例:
<form action="{{route('client.login')}}" method="POST">
@csrf
@method('POST')
<h4 class="login-title">Login</h4>
<div class="login-form">
<div class="row">
<div class="col-md-12 col-12 mb--20">
<label>Email*</label>
<input class="mb-0" type="email" name="email" value="{{ old('email') }}">
</div>
<div class="col-12 mb--20">
<label>Password</label>
<input class="mb-0" type="password" autocomplete="current-password" name="password"
value="{{ old('password') }}">
</div>
<div class="col-md-12">
<div class="d-flex align-items-center flex-wrap">
<button type="submit" class="btn btn-black me-3">Login</button>
<div class="d-inline-flex align-items-center">
<input type="checkbox" id="remember" name="remember" class="mb-0 me-1">
<label for="remember" class="mb-0 font-weight-400">Ricordami</label>
</div>
</div>
@if (Route::has('password.request'))
<p><a href="{{ route('password.request') }}" class="pass-lost mt-3">Password dimenticata?</a></p>
@endif
</div>
</div>
</div>
</form>
我检查了 csrf 令牌,它们匹配。 我的服务器端文件中有完全相同的代码,它们运行良好,但在我的本地服务器上不起作用。 我无法在任何地方找到此错误的日志。
编辑:我的问题在 .env 文件中,我写了一个; 而不是:
删除@method('POST')
这一行并尝试,因为您不需要提及method="POST"
,您已经在表单标签中提到了 method 。 提前欢迎您。
尝试在app.blade.php
文件的头部添加<meta name="csrf-token" content="{{ csrf_token() }}">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.