I'm having a problem with my function. The purpose of my function is to force a string to be downloaded. What it really happens is that the string is outputted to the screen and not downloaded.
Bu benim fonksiyonudur:
function arrayToCSV($vectorDados, $cabecalho)
{
$arr = array();
$arr=$vectorDados;
$csv = $cabecalho . "\n";
foreach($arr as $row) {
$csv .=$row[0] . " " . $row[1] . " ". $row[2] . " " .$row[3] . " \n";
}
$filename = "emails_".date("Y-m-d_H-i",time());
header ("Content-Type: application/octet-stream");
header ("Content-disposition: attachment; filename=".$filename.".csv");
print $csv;
}