会话已过期,无法创建新用户

时间:2019-01-14 07:28:14

标签: php laravel mamp laravel-5.7

我想创建一个注册表单并保留该当前登录用户的会话。昨天运行良好,今天,当我尝试注册新用户时,它说您的会话已过期,请刷新并重试。我尝试了几乎所有解决方案,但无法解决我的问题。 Laravel的新手使用v5.7.19和PHP v7.3

welcome.blade.php

<div class="col-md-6">
    <h3>Sign Up</h3>
    <form action="{{ route('signup')}}" method="post">
        @csrf
        <div class="form-group">
            <label for="email">Your E-mail</label>
            <input class="form-control" type="text" name="email" id="email">
        </div>
        <div class="form-group">
            <label for="first_name">Your First Name</label>
            <input class="form-control" type="text" name="first_name" id="first_name">
        </div>
        <div class="form-group">
            <label for="password">Your Password</label>
            <input class="form-control" type="password" name="password" id="password">
        </div>
        <button type="submit" class="btn btn-primary">Submit</button>
        <input type="hidden" name="_token" value="{{ Session::token() }}">
    </form>
</div>

web.php

Route::group(['middleware' => ['web']], function () {
    Route::get('/', function () {
        return view('welcome');
    });
    Route::post('/signup', [
        'uses' => 'UserController@poignup',
        'as' => 'signup'
    ]);
});

0 个答案:

没有答案