Posted By

sikwan on 10/14/10


Tagged

php csv export


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

dmistriotis
MaxLazar


Export Csv


 / Published in: PHP
 

This snippet make an export in Csv of the var $csvExport. You have to format your var like you can see at the first line.

  1. $csvExport . = $td[0]."|".$td[1]."|".$td[2]."\n"
  2.  
  3. $filename = "ExportCsv";
  4.  
  5. header("Content-type: application/vnd.ms-excel");
  6. header("Content-disposition: csv" . date("Y-m-d") . ".csv");
  7. header("Content-disposition: filename=".$filename.".csv");
  8.  
  9. print $csvExport;

Report this snippet  

You need to login to post a comment.