【问题标题】:Kohana 3.2 request->headers['Content-Type'] keeps failingKohana 3.2 request->headers['Content-Type'] 一直失败
【发布时间】:2011-08-04 20:13:16
【问题描述】:

由于某种原因,这在 Kohana 3.2 中不起作用:

$this->request->headers['Content-Type'] = 'text/xml';

自 Kohana 3.1 以来这是否发生了变化?

【问题讨论】:

    标签: php header kohana content-type kohana-3


    【解决方案1】:

    它也不应该在 3.1 中工作,但这应该:

    $this->request->headers('Content-Type', 'text/xml');
    

    见http://kohanaframework.org/3.2/guide/api/Request#headers 这是从 3.1 开始的请求/响应重构更改之一。

    【讨论】:

    • 我是从 3.0 应用升级...谢谢!我应该更新问题以反映 3.1 吗?
    • 相信你需要在3.2中使用响应对象? $this->response->headers('Content-Type', 'text/xml');
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-29
    • 2013-04-15
    • 2016-01-26
    • 2018-03-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多