之前用html不需要服务器就可以打开,
之后做html与php交互的时候,html浏览器报错了
Access to XMLHttpRequest at ‘http://localhost/phpAdminLogin/login.php’ from origin ‘null’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
原因,php需要
localhost/…的路径才能解析代码
html在浏览器中路径也要用localhost的路径才保证是相同域
跨域时,html路径是
file:///D:/…login.html 与php不在同一个域