Home > Backend Development > PHP Tutorial > 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

高洛峰
Release: 2023-03-05 21:06:02
Original
2048 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template