首页 > 解决方案 > 将项目 Laravel 上传到共享主机(Cpanel)时出现“页面已过期”错误

问题描述

将我的 Laravel 项目上传到共享主机后出现问题。当我通过 Xampp(Localhost) 测试时一切正常。但是在共享主机的生产中,我在每个表单上单击“提交按钮”-> 出现:`页面已过期。尽管我已经Csrf_token并且已经搜索了很多关于我的问题的问题,但我无法解决它。请帮我!!!

这是我的表格:

<form action="{{ route('login') }}" method="post" autocomplete="off">
    @csrf

    <div class="form-group">
        <label for="nrp">NRP</label>
        <input class="form-control @error('nrp') is-invalid @enderror" type="number" name="nrp" id="nrp" autofocus required>
        @error('nrp')
            <span class="invalid-feedback" role="alert">
                <strong>NRP / Password yang dimasukan salah!</strong>
            </span>
        @enderror
    </div>

    <div class="form-group">
        <label for="password">Password</label>
        <input class="form-control" type="password" name="password" id="password" required>
        @error('password')
            <span class="invalid-feedback" role="alert">
                <strong>{{ $message }}</strong>
            </span>
        @enderror
    </div>
            
    <div class="d-flex mb-5 mt-2 align-items-center">
        <label class="control control--checkbox mb-0">
            <span class="caption">Remember me</span>
            <input type="checkbox" name="remember" />
            <div class="control__indicator"></div>
        </label>
        <span class="ml-auto">
            <a href="{{ route('user.register') }}" class="forgot-pass">Register Account</a>
        </span> 
    </div>
    <input type="submit" value="Log In" class="btn btn-block btn-primary">
</form>

路线:

Auth::routes(['verify' => true]);

我正在使用laravel/ui身份验证。

请检查网站以获取错误示例http://etwpad.id/login

标签: phplaravellaravel-7

解决方案


Try creating an application key.

Run php artisan key:generate. This will create a key and place it in your .env file (APP_KEY).

Then php artisan config:cache. This will clear you cache for use of the new key.


推荐阅读