HTML以外での出力
自分用のメモとして。
HTML以外で出力する場合のactionでの方法。
<?php // apps/(myapp)/modules/(mymodule)/actions.actions.class.php public function executeTest() { $content_type = 'text/plain'; sfConfig::set('sf_web_debug', false); // web_debugを無効に $this->setLayout(false); // layoutを無効に $this->getResponse()->setContentType($content_type); // Content-Typeを指定する // echoしてしまう場合 $this->getResponse()->sendHttpHeaders(); // HTTPヘッダ出力 $data = ''; echo $data; return sfView::NONE; }
※追記
sendHttpHeaders()が必要でした