2010-10-20 37 views
0

我基本上是試圖描述 export csv in zend frameworkZend viewRenderer-> setNeverRender();

從ZEND導出爲CSV格式,並使用$this->_helper->viewRenderer->setNeverRender(); 不幸的是,插件代碼仍然包含在csv文件。 任何線索爲什麼?

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="'.$filename.'"'); 
    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;'; 

    } 

回答

0

相信該方法被稱爲「setNoRender()」 ......

QuickNDirty(如在我看你不使用視圖)是「死()」之後所有的呼應是已完成:P