PHP Force Download CSV
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="ramais.csv"');
$saida = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo "id;nome;ramal;email;setor;diretor\r\n";
foreach ($saida as $s){
foreach ($s as $k => $v){
echo "{$v};";
}
echo "\r\n";
}
Adventurous Anaconda