Laravel由于来自站点外部的get请求的不活动错误,页面已过期

时间:2017-12-23 11:54:47

标签: laravel laravel-5

我实施了简单的付款方式以连接到银行并获取结果并使用/product/payment/checkTransaction网址检查付款状态,我没有任何问题可以连接到银行,但点击取消后我想查看付款交易{ {1}}网址,但我收到错误:

The page has expired due to inactivity.
Please refresh and try again. 

我的路线:

Route::group(['middleware' => 'auth:web'], function () {
    $this->post('/product/payment', 'Dashboard\PaymentController@payment');
    $this->post('/product/payment/checkTransaction', 'Dashboard\PaymentController@checkTransaction');
});

付款类:

class PaymentController extends Controller
{
    private $api_key = "XXXX";

    public function payment()
    {
        $this->validate(request(), [
            'product_id' => 'required'
        ]);

        //connect to bank

    }

    public function checkTransaction()
    {
        dd(request()->all());
    }
}

BTW我在课堂上添加了/product/payment/checkTransaction个网址:

class VerifyCsrfToken extends Middleware
{
    protected $except = [
        '/dashboard/administrator/attachImage',
        '/product/payment/checkTransaction'
    ];
}

我该如何解决这个问题

1 个答案:

答案 0 :(得分:0)

此消息发生在laravel版本> = 5.5中,并且当laravel无法正确找到路径时会发生此消息。

你说你点击取消按钮,所以我猜你使用GET方法。将Route :: post更改为Route :: get,看看它是否有效。