JSON数据header头标记设置:
第一种(标准型) header('Content-type: application/json'); 另一种(IE6适合) header('Content-type: text/json');
如果$.getJSON无法获取JSON数据,可以去掉header头试下。
注:如果启用gzip压缩,可以试用application/x-javascript头试下。
Jsonp数据header头标记设置:
header('Content-type:application/javascript');
xml数据header头标记设置:
header ("Content-type: text/xml");
举报
1、在nginx配置文件的Server段里加入: add_header Access-Control-Allow-Origin "http://sebcxy.com"; 注:此方法需要重启nginx服务器。 2、原生PHP函数: header('custom_header:val', true);
本版积分规则 发表回复 回帖后跳转到最后一页
Archiver|手机版|小黑屋|学习笔记
GMT+8, 2024-5-18 15:17 , Processed in 0.022798 second(s), 13 queries , APCu On.
Powered by Discuz! X3.5
© 2001-2024 Discuz! Team.