laravel版本:5.6(最新)php版本:7.1.14系统:Linux服务器API:Apache 2.0处理程序
我的问题是,当我在localhost中运行应用程序时,它工作正常,但当我在服务器上安装此主页时工作正常,但当我尝试登录或尝试注册时显示错误:
"The page has expired due to inactivity. Please refresh and try again"
当我刚删除里面的views文件夹时 / public_html / vendor / laravel / framework / src / Illuminate / Foundation / Exceptions / 然后我得到了这个:
的Symfony \元器件\ HttpKernel \异常\ HttpException ... /供应商/ laravel /框架/ src目录/照亮/基金/例外/ Handler.php204 44 Illuminate \ Foundation \ Exceptions \ Handler prepareException ... /供应商/ laravel /框架/ src目录/照亮/基金/例外/ Handler.php176 43 Illuminate \ Foundation \ Exceptions \ Handler渲染 ... / app / Exceptions / Handler.php51 42 App \ Exceptions \ Handler渲染 ... / vendor / laravel / framework / src / Illuminate / Routing / Pipeline.php83 41 Illuminate \ Routing \ Pipeline handleException ... / vendor / laravel / framework / src / Illuminate / Routing / Pipeline.php55 40 照亮\会议\ TokenMismatchException ... /供应商/ laravel /框架/ src目录/照亮/基金/ HTTP /中间件/ VerifyCsrfToken.php70 39 Illuminate \ Foundation \ Http \ Middleware \ VerifyCsrfToken句柄 ... / vendor / laravel / framework / src / Illuminate / Pipeline / Pipeline.php149 38 Illuminate \ Pipeline \ Pipeline Illuminate \ Pipeline {closure} ... / vendor / laravel / framework / src / Illuminate / Routing / Pipeline.php53 37 Illuminate \ Routing \ Pipeline Illuminate \ Routing {closure} ... /供应商/ laravel /框架/ src目录/照亮/查看/中间件/ ShareErrorsFromSession.php49 36 Illuminate \ View \ Middleware \ ShareErrorsFromSession句柄 ... / vendor / laravel / framework / src / Illuminate / Pipeline / Pipeline.php149 35 Illuminate \ Pipeline \ Pipeline Illuminate \ Pipeline {closure} ... / vendor / laravel / framework / src / Illuminate / Routing / Pipeline.php53 34 Illuminate \ Routing \ Pipeline Illuminate \ Routing {closure} ... /供应商/ laravel /框架/ src目录/照亮/会话/中间件/ StartSession.php63 33 Illuminate \ Session \ Middleware \ StartSession句柄 ... / vendor / laravel / framework / src / Illuminate / Pipeline / Pipeline.php149 32 Illuminate \ Pipeline \ Pipeline Illuminate \ Pipeline {closure} ... / vendor / laravel / framework / src / Illuminate / Routing / Pipeline.php53 31 Illuminate \ Routing \ Pipeline Illuminate \ Routing {closure} ... /供应商/ laravel /框架/ src目录/照亮/曲奇/中间件/ AddQueuedCookiesToResponse.php37 30 Illuminate \ Cookie \ Middleware \ AddQueuedCookiesToResponse句柄 ... / vendor / laravel / framework / src / Illuminate / Pipeline / Pipeline.php149 29 Illuminate \ Pipeline \ Pipeline Illuminate \ Pipeline {closure} ... / vendor / laravel / framework / src / Illuminate / Routing / Pipeline.php53 28 Illuminate \ Routing \ Pipeline Illuminate \ Routing {closure} ... /供应商/ laravel /框架/ src目录/照亮/曲奇/中间件/ EncryptCookies.php59 27 Illuminate \ Cookie \ Middleware \ EncryptCookies句柄 ... / vendor / laravel / framework / src / Illuminate / Pipeline / Pipeline.php149 26 Illuminate \ Pipeline \ Pipeline Illuminate \ Pipeline {closure} ... / vendor / laravel / framework / src / Illuminate / Routing / Pipeline.php53 25 Illuminate \ Routing \ Pipeline Illuminate \ Routing {closure} ... / vendor / laravel / framework / src / Illuminate / Pipeline / Pipeline.php102 24 然后照亮\ Pipeline \ Pipeline ... / vendor / laravel / framework / src / Illuminate / Routing / Router.php661 23 Illuminate \ Routing \ Router runRouteWithinStack ... / vendor / laravel / framework / src / Illuminate / Routing / Router.php636 22 照亮\路由\路由器runRoute ... / vendor / laravel / framework / src / Illuminate / Routing / Router.php602 21 Illuminate \ Routing \ Router dispatchToRoute ... / vendor / laravel / framework / src / Illuminate / Routing / Router.php591 20 照亮\路由\路由器调度 ... /供应商/ laravel /框架/ src目录/照亮/基金/ HTTP / Kernel.php176 19 Illuminate \ Foundation \ Http \ Kernel 照亮\基金会\ HTTP {}关闭 ... / vendor / laravel / framework / src / Illuminate / Routing / Pipeline.php30 18 Illuminate \ Routing \ Pipeline Illuminate \ Routing {closure} ... / vendor / fideloper / proxy / src / TrustProxies.php57 17 Fideloper \ Proxy \ TrustProxies处理 ... / vendor / laravel / framework / src / Illuminate / Pipeline / Pipeline.php149 16 Illuminate \ Pipeline \ Pipeline Illuminate \ Pipeline {closure} ... / vendor / laravel / framework / src / Illuminate / Routing / Pipeline.php53 15 Illuminate \ Routing \ Pipeline Illuminate \ Routing {closure} ... /供应商/ laravel /框架/ src目录/照亮/基金/ HTTP /中间件/ TransformsRequest.php30 14 Illuminate \ Foundation \ Http \ Middleware \ TransformsRequest句柄 ... / vendor / laravel / framework / src / Illuminate / Pipeline / Pipeline.php149 13 Illuminate \ Pipeline \ Pipeline Illuminate \ Pipeline {closure} ... / vendor / laravel / framework / src / Illuminate / Routing / Pipeline.php53 12 Illuminate \ Routing \ Pipeline Illuminate \ Routing {closure} ... /供应商/ laravel /框架/ src目录/照亮/基金/ HTTP /中间件/ TransformsRequest.php30 11 Illuminate \ Foundation \ Http \ Middleware \ TransformsRequest句柄 ... / vendor / laravel / framework / src / Illuminate / Pipeline / Pipeline.php149 10 Illuminate \ Pipeline \ Pipeline Illuminate \ Pipeline {closure} ... / vendor / laravel / framework / src / Illuminate / Routing / Pipeline.php53 9 Illuminate \ Routing \ Pipeline Illuminate \ Routing {closure} ... /供应商/ laravel /框架/ src目录/照亮/基金/ HTTP /中间件/ ValidatePostSize.php27 8 Illuminate \ Foundation \ Http \ Middleware \ ValidatePostSize句柄 ... / vendor / laravel / framework / src / Illuminate / Pipeline / Pipeline.php149 7 Illuminate \ Pipeline \ Pipeline Illuminate \ Pipeline {closure} ... / vendor / laravel / framework / src / Illuminate / Routing / Pipeline.php53 6 Illuminate \ Routing \ Pipeline Illuminate \ Routing {closure} ... /供应商/ laravel /框架/ src目录/照亮/基金/ HTTP /中间件/ CheckForMaintenanceMode.php46 5 Illuminate \ Foundation \ Http \ Middleware \ CheckForMaintenanceMode句柄 ... / vendor / laravel / framework / src / Illuminate / Pipeline / Pipeline.php149 4 Illuminate \ Pipeline \ Pipeline Illuminate \ Pipeline {closure} ... / vendor / laravel / framework / src / Illuminate / Routing / Pipeline.php53 3 Illuminate \ Routing \ Pipeline Illuminate \ Routing {closure} ... / vendor / laravel / framework / src / Illuminate / Pipeline / Pipeline.php102 2 然后照亮\ Pipeline \ Pipeline ... /供应商/ laravel /框架/ src目录/照亮/基金/ HTTP / Kernel.php151 1 Illuminate \ Foundation \ Http \ Kernel sendRequestThroughRouter ... /供应商/ laravel /框架/ SRC /照亮/粉底/ HTTP / Kernel.php116
我的刀片代码:
<div class="form-group row">
<label for="email" class="col-sm-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required autofocus>
@if ($errors->has('email'))
<span class="invalid-feedback">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required>
@if ($errors->has('password'))
<span class="invalid-feedback">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group row">
<div class="col-md-6 offset-md-4">
<div class="checkbox">
<label>
<input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}> {{ __('Remember Me') }}
</label>
</div>
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Login') }}
</button>
<a class="btn btn-link" href="{{ route('password.request') }}">
{{ __('Forgot Your Password?') }}
</a>
</div>
</div>
</form>
如何解决这个问题?
我也尝试了以前的所有问题建议。
我也看到它为'domain' => env('SESSION_DOMAIN', null)
,
并且没有.env喜欢session_domain
答案 0 :(得分:1)
您需要将csrf_filed添加到表单中。 在打开表单标记之后添加它。
{{ csrf_field() }}
编辑:
在laravel 5.6中,您可以在表单标记之后执行@csrf
。
答案 1 :(得分:0)
无论何时在应用程序中定义HTML表单,都应在表单中包含隐藏的 CSRF令牌字段,以便CSRF保护中间件可以验证请求。您可以使用csrf_field
帮助程序生成令牌字段:
<form method="POST" action="/profile">
{{ csrf_field() }}
...
</form>
使用Blades模板 Laravel 5.6及更高版本,非常简单。
<form method="POST" action="/profile">
@csrf
...
</form>
注意:它不起作用,然后刷新浏览器缓存,现在它可能正常工作