how can I force the browser to download a csv file I created in PHP?
I tried
$result = array (
array('aaa', 'bbb', 'ccc', 'dddd'),
array('123', '456', '789'),
array('aaa', 'bbb')
);
$filename = 'result_file.csv';
header("Content-Type: text/plain");
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Length: " . strlen($result));
echo $result;
exit;
but the csv file is full of PHP errors