PHP 代理作为中间件
我创建了一个代理页面,用于从 javascript 客户端调用 xml。我已经放置了
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Cache-Control: no-cache');
header('Pragma: no-cache');
//header('Access-Control-Allow-Credentials: false');
$header[] = "Content-type: text/xml";
但是当我通过 jquery 或任何其他框架调用时它仍然向我显示访问源问题。我已将 PHP 文件放置在不同的域中。
我该如何解决这个问题?
I have created a proxy page for calling xml from javascript client. I have placed
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Cache-Control: no-cache');
header('Pragma: no-cache');
//header('Access-Control-Allow-Credentials: false');
$header[] = "Content-type: text/xml";
But when I m calling though jquery or any other framework it is still showing me access origin issue. PHP file i have placed in different domain.
How to I can solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你缓存了吗?清除它并重试。
如果它显示其他域中的 php 文件并且 CORS 页面没有重定向,那么只要浏览器支持它,就应该没有问题。
Are you cached? Clear it and try again.
If it is showing the php file in the other domain and the CORS page is not redirecting, it should have no problems as long as the browser supports it.