php – magento中getcsv()和getcsvfile()方法有什么区别?
发布时间:2020-12-13 22:51:59 所属栏目:PHP教程 来源:网络整理
导读:我正在尝试将Admin Html网格导出为CSV.我有两个方法getCsv()和getCsvFile()用于将结果网格导出为CSV文件.请问有谁能告诉我这两个功能有什么区别? 方法-1 $fileName = "filename.csv";$content = $this-getLayout()-createBlock('custom_modelue/adminhtml_r
我正在尝试将Admin
Html网格导出为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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |