0
在我的控制器init方法我有這個我怎麼建立一個ContextSwitch裏生成CSV文件
public function init()
{
//initialise the context switch action helper
$this->_helper->getHelper('contextSwitch')
->addContext('csv', array('suffix' => 'csv',
'headers' => array(
'Context-Type' => 'application/csv',
'Context-Disposition' => 'inline; filename="fooo.csv"',
'Pragma' => 'no-cache',
'Expires' => '0',
)))
->addActionContext('stockreport', 'csv')
->initContext();
}
在我stockreportAction我已經停用的佈局和視圖呈現如下。
public function stockreportAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
echo 'foobar';
}
我得到一個空白頁時,我把這個文件,我想產生這種所以這個例子「foobar的」顯示爲一個可下載的CSV文件。任何人都可以建議
可Zend_Smug了嗎? – user466764