浏览器同源策略阻止ajax请求


Cross-Origin Resource Sharing,跨域资源共享,简称 CORS,能够做为一种跨域请求以及响应的解决方案。php

1.恳求的url是PHP的,需要PHP中echo:header""Access-Control-Allow-Origin: *"");这是针对所有的对这个页面的请求,<?php  header('Access-Control-Allow-Origin:http://A.abc.com'); ?>指定惟一容许访问的页面;html

2.html的,需要 <meta http-equiv="Access-Control-Allow-Origin" content="*">跨域

相关文章
相关标签/搜索