Home >Backend Development >PHP Problem >How to solve Chinese garbled characters in php

How to solve Chinese garbled characters in php

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-09-25 14:41:084685browse

How to solve Chinese garbled characters in php

In PHP, Chinese garbled characters are very troublesome and troublesome, so based on my experience in programming, I summarize the following methods (taking utf_8 as an example):

Related recommendations: "php Basic Tutorial"

1. Set the encoding method in the header in php

header("Content-type:text/html;charset=utf-8");

2. Use iconv in php Transcoding

echo iconv("GB2312","UTF-8",'中文内容');

3. Use 0b06b01d593eb6158ab14a0c0e15c90d tag to declare

<meta http-equiv="Content-Type" content="text/html; charset="utf-8" />
in html

The above is the detailed content of How to solve Chinese garbled characters in php. For more information, please follow other related articles on 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