Good afternoon, I have a problem generating a csv file and opening it with excel, this opens showing all the data but does not separate them by column only places in column A here I share the code
public function generar_excel(){
$condiciones = $_SESSION['condiciones']['condiciones'];
$data_excel = $this->modelo_base_m->seguimiento_excel($condiciones);
//prp($data_excel,1);
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"Seguimientos_Menores_5\"");
$outputBuffer = fopen("php://output", 'w');
foreach ($data_excel as $i => $valor) {
fputcsv($outputBuffer, $valor,';');
}
fclose($outputBuffer);
exit;
$this->index();
}
in the fputcsv line I put the third semicolon parameter so that it separates them but in the same way places them in a cell.