I found out on Baidu that I needed to change the file in other tutorials, which is actually very simple. The official provides an interface that can be used to set it up;
Laravel's csrf prevention is effective through middleware in the app/http/Middleware directory, as shown below in the official code
There is a property $except, which can be specially used to set which routes do not need to be used for csrf verification;
<?php namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier; class VerifyCsrfToken extends BaseVerifier { /** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ 'api/v1/screen', 'api/v1/notice', ]; }
For example, as shown above, when the browser's url is domain name /api/v1/screen, csrf will not be verified
The above example of the laravel csrf exclusion, prohibition, and closing specified routes is all the content I share with you. I hope you can give you a reference and I hope you can support me more.