我如何设置正确的json头文件? [英] How do I set the correct json headers?

查看:323
本文介绍了我如何设置正确的json头文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人在htaccess中确保我的json头文件是正确的?



更新:有人看到json的这些头文件有什么问题吗?

 日期2010年7月26日星期一08:31:11 GMT 
服务器Apache / 2.2.15(Unix)mod_ssl / 2.2。 15 OpenSSL / 0.9.7a mod_fcgid / 2.3.5 Phusion_Passenger / 2.2.15 mod_auth_passthrough / 2.1 mod_bwlimited / 1.4 FrontPage / 5.0.2.2635
X-Powered-By PHP / 5.2.13
X-Pingback http: //brettbarros.com/wordpress/xmlrpc.php
Content-Disposition附件;文件名=json_api.json
不同的接受编码
内容编码gzip
内容长度719
Keep-Alive timeout = 5,max = 98
连接Keep-Alive
Content-Type application / json; charset = UTF-8

具体来说,它在ie8,ffx,chrome中使用jquery的getJSON,但不能ie7或ie6 ...

解决方案

您可以使用 Firebug的 Net选项卡。它显示了请求和响应的所有标题。


Is there a way in htaccess to ensure the headers for my json are correct?

Update: Does anyone see anything wrong with these headers for json?

Date    Mon, 26 Jul 2010 08:31:11 GMT
Server  Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.7a mod_fcgid/2.3.5 Phusion_Passenger/2.2.15 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By    PHP/5.2.13
X-Pingback  http://brettbarros.com/wordpress/xmlrpc.php
Content-Disposition attachment; filename="json_api.json"
Vary    Accept-Encoding
Content-Encoding    gzip
Content-Length  719
Keep-Alive  timeout=5, max=98
Connection  Keep-Alive
Content-Type    application/json; charset=UTF-8

Specifically, it's working with jquery's getJSON in ie8, ffx, chrome, but not ie7 or ie6...

解决方案

You can inspect the headers sent along from the server side using Firebug's Net tab. It shows all the headers for both the request and the response.

这篇关于我如何设置正确的json头文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆