Home  >  Article  >  Backend Development  >  Perfectly solves the problem of garbled characters when exporting data in Excel's .csv format from PHP

Perfectly solves the problem of garbled characters when exporting data in Excel's .csv format from PHP

高洛峰
高洛峰Original
2017-02-20 17:31:091951browse

The following editor will bring you an article that perfectly solves the problem of garbled characters when exporting Excel's .csv format data from PHP. The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor and take a look.

1. header('Content-Encoding: XXXX');


It may be an encoding problem: You can try UTF-8, GBK, GB2312, and other encoding formats

2. It may be a file encoding problem, although UTF-8 is not recommended With BOM, but the exported excel is a Microsoft product, so the file format needs to be changed to UTF-8 which has BOM format.

完美解决php 导出excle的.csv格式的数据时乱码问题

The above article perfectly solves the problem of garbled characters when exporting Excel's .csv format data from PHP. This is all the content shared by the editor. I hope it can give you a reference. I also hope that everyone will support the PHP Chinese website.

For more related articles that perfectly solve the problem of garbled characters when exporting excel’s .csv format data from PHP, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn