Zend viewRenderer->setNeverRender();
I am basically trying to export from ZEND to csv as described export csv in zend framework
and use the $this->_helper->viewRenderer->setNeverRender();
unfortunately the plugin code is still contained in the csv file.
Any clue why?
public function indexAction() {
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNeverRender();
$filename = "Test".'-'.date('Ymd').'.csv';
header("Content-type: text/csv; charset=UTF-8; header=present");
header('Content-Disposition: attachment; filename="'.$fi开发者_开发百科lename.'"');
header("Content-Transfer-Encoding: binary");
header("Pragma: no-cache");
header("Expires: 0");
mb_internal_encoding("UTF-8");
mb_http_output("UTF-8");
//foreach ($data as $record) {
echo chr(13).chr(10);
//echo '<br>';
echo 'AMB-'.'1;';
echo chr(13).chr(10);
//echo '<br>';
echo 'AMB-'.'1;';
}
I believe the method is called "setNoRender()"...
QuickNDirty solution (as I see you don't use view) is to "die()" after all the echoing is finished :P
精彩评论