Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Laravel 5.2禁用csrf_令牌_Laravel_Laravel 5.2 - Fatal编程技术网

Laravel 5.2禁用csrf_令牌

Laravel 5.2禁用csrf_令牌,laravel,laravel-5.2,Laravel,Laravel 5.2,如何仅为此路由禁用CsrfToken?当我使用web中间件不起作用时,当我使用这种方式不起作用时。请帮忙 这是我的路由器: Route::post('payment_check/{order_id}', ['as' => 'payment', 'uses' => 'users\ChargeController@payment_check']); 这是我的verifycsrftoken.php protected $except = [ 'payment' ]; 和Ker

如何仅为此路由禁用CsrfToken?当我使用web中间件不起作用时,当我使用这种方式不起作用时。请帮忙 这是我的路由器:

 Route::post('payment_check/{order_id}', ['as' => 'payment', 'uses' => 'users\ChargeController@payment_check']);
这是我的verifycsrftoken.php

protected $except = [
    'payment'
];
和Kernel.php

protected $middleware = [
    \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
];

/**
 * The application's route middleware groups.
 *
 * @var array
 */
protected $middlewareGroups = [
    'web' => [
        \App\Http\Middleware\EncryptCookies::class,
        \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
        \Illuminate\Session\Middleware\StartSession::class,
        \Illuminate\View\Middleware\ShareErrorsFromSession::class,
        \App\Http\Middleware\VerifyCsrfToken::class,
    ],
    'api' => [
        'throttle:60,1',
    ],
];

/**
 * The application's route middleware.
 *
 * These middleware may be assigned to groups or used individually.
 *
 * @var array
 */
protected $routeMiddleware = [
    'auth' => \App\Http\Middleware\Authenticate::class,
    'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
    'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class,
    'userAccess' => \App\Http\Middleware\userAccessMiddleWare::class,
    'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
    'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
];
应该是

protected $except = [
    'payment_check/*'
];

在您的verifycsrftoken.php中,csrf是一种防止跨站点请求伪造的保护,禁用它是一件坏事!定义“除外”下的路线,如@Mahfuzul所述,它将跳过所有“付款检查”下路线的csrf。
protected $except = [
    'payment'
];