跳转至主要内容

C'est La Vie

页面返回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');
分类:

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注