Home>Article>Backend Development> PHP solves Chinese garbled characters

PHP solves Chinese garbled characters

不言
不言 Original
2018-06-02 11:44:19 1287browse

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). Let’s take a look at them together

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),

1. Set the encoding method in the header in .php

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

Use iconv to transcode in 2.php

echo iconv("GB2312","UTF-8",'Chinese content');

3. Use the tag to declare

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

These are often used in programming, if there are any Any suggestions on other methods are welcome!

The above is the detailed content of PHP solves Chinese garbled characters. 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