问题
there is a route like:
Route::post('user/{id}/update','UserController@update');
I want to disable csrf protection for it, but i don't know how to add its uri into except
array.
回答1:
You can add the given code in VerifyCsrfToken
file at App/Http/Middleware
protected $except = [
'user/*',
];
or you can disable it on route file
Route::post('user/{id}/update', [
'uses' => 'UserController@update',
'nocsrf' => true,
]);
来源:https://stackoverflow.com/questions/41757431/how-to-disable-csrf-protection-for-a-route-with-parameter