Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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
";
  foreach ($saida as $s){
  	foreach ($s as $k => $v){
  		echo "{$v};";
	  }
	  echo "
";
  }
 
PREVIOUS NEXT
Tagged: #php #force #download #csv
ADD COMMENT
Topic
Name
9+6 =