PHP 页面返回JSON或XML数据时的header头 页面返回JSON时,经常忘记发送header,记录下来,备忘: header('Content-Type: a […] hliang02012-10-17 页面返回JSON时,经常忘记发送header,记录下来,备忘: header('Content-Type: application/json; charset=utf-8'); 或 header('Content-Type: text/plain; charset=utf-8'); 页面返回XML时,也要发送一下header: header('Content-type: text/xml');