Error:
前端访问后端时出现如下报错:
Access to XMLHttpRequest at 'http://localhost:8000/api/slideshow' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
解决:
安装 CORS Middleware for Laravel. (fruitcake /laravel-cors)
The laravel-cors package allows you to send Cross-Origin Resource Sharing headers with Laravel middleware configuration.
https://github.com/fruitcake/laravel-cors