Regarding the fgetcsv operation problem in the tutorial
学海无涯
学海无涯 2019-01-18 21:40:29
0
2
1144

$data = [
[1,'Deng','php'],
[1,'Deng','html'],
[1,'Deng','css' ]
];
foreach ($data as $v){
fputcsv($file,$v);
}
print_r(fgetcsv($file));

微信截图_20190118213813.png微信截图_20190118213835.png

There is no problem with the code and the written csv file, but the format of the printed array is wrong.

Finally find out, Deng. Just change it to English. What's the answer? Doesn’t it support Chinese writing?


学海无涯
学海无涯

reply all(1)
ringa_lee

fgetcsv is sensitive to locale settings. For example, if LANG is set to en_US.UTF-8, single-byte encoded files will have read errors.

setlocale(LC_ALL, 'zh_CN'); Set Simplified Chinese

Then check the csv file encoding problem, open the csv with Notepad, the encoding setting is consistent with the server, such as utf8

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template