- 在输出之前设置 setlocale(LC_ALL, 'zh_CN');
-
str = mb_convert_encoding(str, "cp936", "UTF-8");
fputcsv(file, explode(',',str));
fp = fopen(fileName, 'w'); //生成临时文件
fileNameArr[] =fileName;
// 将数据通过fputcsv写到文件句柄
fwrite(fp,chr(0xEF).chr(0xBB).chr(0xBF));//输出BOM头 fputcsv(fp, $cellData);