在location ~ .php(.*)${}中添加以下代码即可
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PATCH, DELETE, PUT, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, X-Custom-Header, Access-Control-Expose-Headers, Token, Authorization';
#add_header 'Access-Control-Allow-Credentials' 'true'; # 是否允许使用cookies
#add_header 'Access-Control-Max-Age' 1800; #指定本次预检请求的有效期