1 header('Content-Type: text/csv');
2 header('Content-Disposition: attachment; filename="ramais.csv"');
3
4 $saida = $stmt->fetchAll(PDO::FETCH_ASSOC);
5 echo "id;nome;ramal;email;setor;diretor\r\n";
6 foreach ($saida as $s){
7 foreach ($s as $k => $v){
8 echo "{$v};";
9 }
10 echo "\r\n";
11 }