An example of how PHP processes excelcvs tables. The copy code is as follows: PREcode? Php?dataarray({{convertacvsfiletoanarray=data=handlefopen(data.csv, r); while ($ curlinefgetcsv ($ handle,
The code is as follows:
$data = array();
//convert a cvs file to an array $data
$handle = fopen("data.csv","r");
while ($curline = fgetcsv($handle, 1000, ",")){
$tmp = array();
$num = count($curline);
for($c=0; $c < $num; $c++){
array_push($tmp, $curline[c]);
}
array_push($data, $tmp);
}
print_r($data);
fclose($handle);
//convert array $data back to a cvs file
$handle = fopen("result.csv","w");
foreach($data as $curline){
if(fputcsv($handle, $curline)==false){
die("cannot write CSV line");
}
}
fclose($handle);
?>
The http://www.bkjia.com/PHPjc/327169.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/327169.htmlTechArticle code is as follows: PRE class = php name = "code "? Php $ data = array (); // convert a cvs file to an array $ data $ handle = fopen ("data.csv", "r "); while ($ curline = fgetcsv ($ handle ,...