我正在尝试将我的数据库导出到 .csv 导出完成,但它将所有字段放在一列中(不分隔)
编码 :
$sql = "SELECT ARP_name ,Student_name ,institute ,id ,Major from istyle ";
$results=mysql_query($sql);
$filename = "uploaded/".time().".csv";
$handle = fopen($filename, 'w+');
fputcsv($handle, array_keys("ARP_name","Student_name","institute"));
while($row = mysql_fetch_assoc($results))
{
fputcsv($handle, array($row["ARP_name"], $row["Student_name"],$row["institute"]));
}
结果是: