[Solved] has been blocked by CORS policy: Response to preflight request doesn‘t pass access control check: No

Has been blocked by CORS policy: response to preflight request doesn’t pass access control check: no ‘access control allow origin’ header is present on the requested resource.
seeing this error in the webpage, I know that it must be a cross domain problem of Ajax requests.
there are two solutions to this problem, as you should know after reading my article, Before I sent the front-end solution, I don’t know how to flip through my article list
today we talk about the server-side solution
add this code before the JSON data to be returned:

// Specify to allow access to other domains
// Response type
// response header settings

Here is the PHP code, you can also change it to the corresponding java code.

Read More: