【问题标题】:The page has expired due to inactivity. Please refresh and try again. Laravel 5.5 Production由于不活动,该页面已过期。请刷新并重试。 Laravel 5.5 生产
【发布时间】:2018-09-16 03:39:03
【问题描述】:

我正在尝试提交登录页面,以便我可以访问。它处于生产阶段。在 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) 改变存储路径的写权限

可能是什么问题?

【问题讨论】:

  • 检查您在登录页面上获得的会话 cookie,并确保您发送的表单提交是相同的。如果不是,那么您的 cookie 设置中可能设置了一些奇怪的路径或主机。
  • @apokryfos,感谢您的提醒,没有意识到这是输出!

标签: php laravel csrf laravel-5.5


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2018-02-19
    • 2018-03-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-17
    • 1970-01-01
    • 2018-05-07
    • 2018-07-22
    相关资源
    最近更新 更多