由于不活动,该页面已过期。请刷新并重试。 Laravel 5.5生产

时间:2018-04-06 07:04:21

标签: php laravel csrf laravel-5.5

我正在尝试提交登录页面,以便我可以访问。它处于生产阶段。在localhost中,它可以很好地工作,但在托管时它会在线上带来此错误

  

由于不活动,该页面已过期。请刷新并重试。

我的登录页面:

@extends('layouts.app')

@section('content')
<!-- begin login -->
        <div class="login bg-black animated fadeInDown">
            <!-- begin brand -->
            <div class="login-header">
                <div class="brand">
                    <!-- <span class="logo"></span> Color Admin -->
                    AGPAHI
                    <small>Reporting Portal</small>
                </div>
                <div class="icon">
                    <i class="fa fa-sign-in"></i>
                </div>
            </div>
            <!-- end brand -->
            <div class="login-content">
                    {{--  <img src="{{ asset('img/AGPAHI.png') }}"><br/>  --}}

                <form class="margin-bottom-0" method="POST" action="{{ route('login') }}">
                    <input type="hidden" name="_token" value="{{ csrf_token() }}">

                    <div class="form-group m-b-20">
                        <input type="text" name="email" id="email" class="form-control input-lg inverse-mode no-border" placeholder="Email Address" required autofocus/>

                        @if ($errors->has('email'))
                            <span class="help-block">
                                <strong>{{ $errors->first('email') }}</strong>
                            </span>
                        @endif
                    </div>
                    <div class="form-group m-b-20">
                        <input type="password" class="form-control input-lg inverse-mode no-border" name="password" placeholder="Password" required />

                        @if ($errors->has('password'))
                            <span class="help-block">
                                <strong>{{ $errors->first('password') }}</strong>
                            </span>
                        @endif
                    </div>
                    <div class="checkbox m-b-20">
                        <label>
                            <input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}> Remember Me
                        </label>
                    </div>
                    <div class="login-buttons">
                        <button type="submit" class="btn btn-success btn-block btn-lg">Login</button>
                        <a class="btn btn-link" href="{{ route('password.request') }}">
                            Forgot Your Password?
                        </a>
                    </div>
                </form>
            </div>
        </div>
        <!-- end login -->
@endsection

我做了什么: 1)在表单中添加了csrf标记 2)更改了存储路径上的写入权限

可能是什么问题?

1 个答案:

答案 0 :(得分:-1)

您可以将<input type="hidden" name="_token" value="{{ csrf_token() }}">更改为{{ csrf_field() }} 并且,在此运行命令之后 php artisan config:cache php artisan config:cache