Horde_Data_Csv::exportFile PHP Method

exportFile() public method

Builds a CSV file from a given data structure and triggers its download. It DOES NOT exit the current script but only outputs the correct headers and data.
public exportFile ( string $filename, array $data, boolean $header = false, $export_mapping = [] )
$filename string The name of the file to be downloaded.
$data array A two-dimensional array containing the data set.
$header boolean If true, the rows of $data are associative arrays with field names as their keys.
    public function exportFile($filename, $data, $header = false, $export_mapping = array())
    {
        if (!isset($this->_browser)) {
            throw new LogicException('Missing browser parameter.');
        }
        $export = $this->exportData($data, $header, $export_mapping);
        $this->_browser->downloadHeaders($filename, 'application/csv', false, strlen($export));
        echo $export;
    }