Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/sbboke.com/wp-content/plugins/wordpress-seo/src/integrations/front-end-integration.php:409) in /www/wwwroot/sbboke.com/wp-content/themes/pacify/content-single.php on line 5

magento中getcsv()和getcsvfile()方法有什么区别?

我正在尝试将AdminHtml网格导出为CSV。
我有两个方法getCsv()和getCsvFile()用于将结果网格导出为CSV文件。
请问有谁能告诉我这两个功能有什么区别?

方法-1

$fileName = "filename.csv";
$content    = $this->getLayout()->createBlock('custom_modelue/adminhtml_report_grid')
            ->getCsv();
$this->_prepareDownloadResponse($fileName, $content);

方法-2

$fileName = "filename.csv";
$content    = $this->getLayout()->createBlock('custom_modelue/adminhtml_report_grid')
            ->getCsvFile();
$this->_prepareDownloadResponse($fileName, $content);

当我使用方法-1时,滤镜未应用于导出CSV结果。但在方法-2中,过滤器适用于结果集

getCsv()和getCsvFile()之间的区别如下

get CsvFile() is 

     Retrieve a file container array by grid data as CSV

     Return array with keys type and value

     return array

在大多数情况下,getcsvFile用于将网格包含到magen中的csv到系统

  and getCsv() is 
    Retrieve Grid data as CSV
    and return string

相关文章

0 0 投票数
文章评分
订阅评论
提醒
0 评论
内联反馈
查看所有评论