页面返回JSON或XML数据时的header头
hliang
最后编辑于 2012年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');