它在本地机器上工作正常但在托管站点发布数据时它会给出Token Mismatch异常(VerifyCsrfToken)

时间:2017-05-05 11:37:00

标签: laravel laravel-5.2 hosting laravel-5.3 web-hosting

我通过从本地计算机复制项目来托管我的Laravel项目。我已经包含{csrf_token}并且还删除了令牌会话文件,但它仍然提供相同的错误。请有人帮我解决这个问题



<form class="login-form" method="POST" role="form" action="{{url('/login') }}">
          {{ csrf_field() }}

          <div class="row margin">
            <div class="input-field col s12">
              <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                <i class="mdi-social-person-outline prefix"></i>
                <input class="validate" id="email" name="email" type="email" placeholder="Email" required autofocus>
                <label for="email" data-error="wrong" data-success="right" class="center-align"></label>
                @if ($errors->has('email'))
                <span class="help-block">
                  <strong>{{ $errors->first('email') }}</strong>
                </span>
                @endif
              </div>
            </div>
          </div>


          <div class="row margin">
            <div class="input-field col s12">
              <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                <i class="mdi-action-lock-outline prefix"></i>
                <input id="password" type="password" name="password" placeholder="Password" required>
                <label for="password"></label>
                @if ($errors->has('password'))
                <span class="help-block">
                  <strong>{{ $errors->first('password') }}</strong>
                </span>
                @endif
              </div>
            </div>
          </div>

          <div class="row">          
            <div class="input-field col s12 m12 l12  login-text">
              <input type="checkbox" name="remember" id="remember-me" />
              <label for="remember-me">Remember me</label>
            </div>
          </div>

          <div class="row">
            <div class="input-field col s12">
              <button class="btn waves-effect waves-light col s12" type="submit" >Login</button>
            </div>
          </div>

          <div class="row">
            <div class="input-field col s6 m6 l6">
              <p class="margin medium-small"><a href="{{ url('register')}}">Register Now</a></p>
            </div>
            <div class="input-field col s6 m6 l6">
              <p class="margin right-align medium-small"><a href="{{ url('/password/reset') }}">Forgot password</a></p>
            </div>          
          </div>
          <div class="row">
            <div class="input-field col s6 m6 l6">
              <a class="loginBtn loginBtn--facebook" href="{{ url('redirect/facebook')}}">
                                    Login with Facebook </a>
            </div>
          </div>
          <div class="row">
            <div class="input-field col s6 m6 l6">
              <a class="loginBtn loginBtn--facebook" href="{{ url('redirect/google')}}" >
                              Login with Google</a>
            </div>
          </div>

        </form>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

检查配置文件中的APP_URL

APP_URL=http://localhost

确保与您的域名相同,并在laravel中清除缓存

Route::get('/clear-cache', function() {
$exitCode = Artisan::call('cache:clear');
// return what you want
});