2012-10-24 37 views
2

可能重複:JSON mime類型動態創建的內容用PHP

header('Content-Type', 'application/json'); 

correct HTTP header for json file

我已經使用下面的行設置的PHP文件的頭部

服務器失敗,顯示錯誤消息:

"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 

無論工作過。我會很感激任何進一步的幫助。

回答

5
header('Content-type: application/json'); 
1

通知,其中報價都在header()

header('Content-type: application/json');