例如
$head = [
'邮箱','报名时间'
];
$fp = fopen('shide415.csv','a');
//这段代码很重要解决utf8乱码问题
fprintf($fp, chr(0xEF).chr(0xBB).chr(0xBF));
fputcsv($fp,$head);
//写入内容
fputcsv($fp,['邮箱','报名时间']);
//关闭文件
fclose($fp);
$head = [
'邮箱','报名时间'
];
$fp = fopen('shide415.csv','a');
//这段代码很重要解决utf8乱码问题
fprintf($fp, chr(0xEF).chr(0xBB).chr(0xBF));
fputcsv($fp,$head);
//写入内容
fputcsv($fp,['邮箱','报名时间']);
//关闭文件
fclose($fp);