我使用以下行设置了php文件的标题:
header('Content-Type', 'application/json');
服务器失败并显示错误消息:
"Tue Oct 23 16:20:09 2012] [error] [client 111.111.111.111] malformed header from script. Bad header=Content-Type: xyz.php, referer:...."
我在网上提出了一些建议,将其添加到.htaccess文件
AddType application/json .json
两者都没有奏效。如果有任何进一步的帮助,我将不胜感激。
答案 0 :(得分:5)
header('Content-type: application/json');
答案 1 :(得分:1)
注意引号位于header()
header('Content-type: application/json');