Hire a web Developer and Designer to upgrade and boost your online presence with cutting edge Technologies

Friday, October 7, 2022

How to create a CSV file using PHP easily

 The example is shown with the help of XAMPP server installed in windows 10 PC.

The below code can be used to create a CSV file.


<?php
header("Content-type: text/plain");
header("Content-Disposition: attachment; filename=jinu.csv");
echo '"jinu","jawad","one","two"'."\n";
echo '"jinu","jawad","one","two"'."\n";;
echo '"jinu","jawad","one","two"'."\n";;
for ($x = 0; $x <= 100; $x++) {
echo '"'.$x.'","jinu","jawad"'."\n";
}
?>

No comments:

Post a Comment