SegmentFault (www. sf. gg) is a leading developer technology community in China. We hope to provide programmers with a pure and high-quality technology exchange platform to learn, communicate and grow with developers and create an era for developers!
Reply content:
The two encoding formats are inconsistent.
// CSV Excel supports GBK encoding and must be converted; otherwise, garbled code $ content = iconv ('utf-8', 'gbk // ignore ', $ content );
Two-dimensional array:
Foreach ($ dataArr as $ key => $ value) {foreach ($ value as $ k1 => $ v1) {$ value [$ k1] = iconv ('utf-8', 'gbk // ignore ', $ v1);} fputcsv ($ fh, $ value );} fclose ($ fh );
It should be about encoding.
// Transcode the header: $ header_data = ['first Column', 'second column']; echo iconv ('utf-8', 'gbk // transtranstranscoder ', '"'. implode ('","', $ header_data ). '"'. "\ n ");
Try it ~
For details, refer to: PHP to read/export CSV files.
Check whether the file content encoding is normal for the csv file you generated or the csv file you sent before?
Mail says it's strange to me