First, PHP generates Excel
Using the Phpexcel class file to generate
Second, PHP generated CSV
<?php
$action = "Make";
if ($action = = ' Make ') {
$fp = fopen ("Demo_csv.csv", "a"); Open the CSV file and create it if it does not exist
$title = Array ("First_Name", "last_name", "Contact_email", "telephone"); First row of data
$data _1 = Array ("42343", "423432", "4234", "4234");
$data _2 = Array ("4234", "last_name", "Contact_email", "telephone");
$title = Implode (",", $title); Use ' Split into string '
$data _1 = Implode (",", $data _1); Use ' Split into string '
$data _2 = Implode (",", $data _2); Use ' Split into string '
$data _str = $title. " \ r \ n ". $data _1." \ r \ n ". $data _2." \ r \ n "; Add line break
Fwrite ($fp, $data _str); Write Data
Fclose ($FP); Close file handle
echo "Build Success";
}
echo "<br>";
echo "<a href= '? action=make ' > Generate CSV file </a>";
?>
PHP generates Excel or PHP generated CSV