简体   繁体   English

更改Kohana3中的Content-type标头

[英]Change Content-type header in Kohana3

I'm trying to create a rss feed in my Kohana app. 我正在尝试在我的Kohana应用中创建一个RSS供稿。 I did this in my controller: 我在控制器中做到了这一点:

public function action_rss()
{
    $games = ORM::factory('game')
        ->order_by('name','ASC')
        ->find_all()
        ->as_array();

    $view = View::factory('home/rss')
        ->bind('games', $games);

    $this->request->$headers['Content-type'] = 'application/rss+xml; charset=UTF-8';

    $this->request->response = $view;
}

It doesn't work (when I remove the $headers line, it does, but with a html type). 它不起作用(当我删除$ headers行时,它起作用了,但是带有html类型)。 How can I send the response as rss+xml ? 如何将响应作为rss + xml发送?

Thank you. 谢谢。

如果您摆脱$headers中的$ ,这应该可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM