Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

php - 419 Page Expired Laravel 5.8 - After Login

I Created one Project in Laravel 5.8. In my Local Environment(PHP 7.2) its working good. when i hosted this project in to my server(PHP 7.1) using cpanel after login its return 419 Page Expired Error.

Mylogin Form Code :

<form method="POST" action="{{ route('login') }}" id="login-form">
    @csrf
    <div class="form-group">
      <label for="username">{{ __('Username / Email Address') }}</label>
      <input type="text" class="form-control{{ $errors->has('username') ? ' is-invalid' : '' }} boxed" name="username" id="username" value="{{ old('username') }}" required autofocus>
    </div>
    @if ($errors->has('email'))
       <span class="invalid-feedback" role="alert">
          <strong>{{ $errors->first('email') }}</strong>
       </span>
    @endif

    <div class="form-group">
        <label for="password">{{ __('Password') }}</label>
        <input type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }} boxed" name="password" id="password" required>
    </div>
    @if ($errors->has('password'))
        <span class="invalid-feedback" role="alert">
           <strong>{{ $errors->first('password') }}</strong>
        </span>
    @endif

    <div class="form-group" style="margin-bottom: 0px; float:left;">
        @if (Route::has('password.request'))
            <a href="{{ route('password.request') }}" class="forgetpwd">
               {{ __('Forgot Your Password?') }}
            </a>
        @endif
    </div>

    <div class="form-group" style="text-align: center;">

        <button type="submit" class="btn btn-warning" style="padding:0.5rem 1.8rem;">Login</button>
    </div>
</form>

I cleared Cache and Cookies but, Same issue Displayed.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In all probably, you are missing @csrf.

Just add @csrf following right after your form opening tag line. It should look like this:

<form class="singn-form" method="POST" action="{{ route('register') }}">
@csrf
....
</form>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...