[PHP] 回傳JSON資料格式,Header修改 (Content-Type: application/json)

PHP Header code for JSON response:

header('Content-Type: application/json; charset=utf-8');

另外補上XML:

header('Content-type: text/xml');

Leave a Reply

Your email address will not be published. Required fields are marked *