【发布时间】:2013-12-27 13:46:14
【问题描述】:
我有一个奇怪的问题,
使用restler api时,即使我强行将其设置为不同的内容,标题内容类型似乎也会重置......
好像
$r = new Restler();
$r->setSupportedFormats('JsonFormat');
始终将其重置为“Content-Type: application/json; charset=utf-8”
那么,我可以通过什么方式手动将默认的 mime 类型覆盖为我想要的类型?
除此之外,似乎没有任何问题,这是您请求文件下载时的外观:Cache-Control: no-cache, must-revalidate
Connection: Keep-Alive
Content-Disposition: attachment; filename="test.pdf"
Content-Encoding: gzip
Content-Language: en
Content-Length: 25
Content-Type: application/json; charset=utf-8
这是我在 phpcode 中设置的:
header("Content-type: application/pdf");
header("Content-Length: ". $data["Size"]);
header('Content-Disposition: attachment; filename="'. $data["Name"].'"');
任何帮助强制它作为我喜欢的内容类型? (jftr、pdf就是一个例子,还有很多可能的类型)
【问题讨论】: