2012-02-20 13 views
0

にKohanaの3でのContent-Typeを変更するいくつかの問題が生じています私のコードです:は、私がここでXML

class Controller_Call extends Controller { 

    public $template = 'tpl/default'; 

    public function before() { 

      parent::before(); 

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

      $this->template = View::factory($this->template); 

    } 

    public function action_index() { 

      $this->template->response = '<say>Hey! How are you budy!</say>'; 

    } 

    public function after() { 

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

      $this->response->body($this->template); 

      parent::after(); 

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

    } 

} 

私はFirefoxでページをロードし、私はContent-Typeのを見たとき、私は/テキストを取得しますhtml。

なぜですか?

は、あなたが応答にヘッダーを設定する必要があり、事前

答えて

3

中ありがとうございました:

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