PHP method to solve Chinese garbled characters

墨辰丷
Release: 2023-03-27 16:22:02
Original
4787 people have browsed it

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 it with the editor

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 tag declaration in html

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

These are often used in programming, If there are other methods, please give us some advice!

The above is the entire content of this article, I hope it will be helpful to everyone’s study.


Related recommendations:

The html page uses include to import the php file and there is an extra blank line_HTML/Xhtml_Web page production

##php , js, css string interception methods collection_javascript skills

PHP

#######

The above is the detailed content of PHP method to solve Chinese garbled characters. For more information, please follow other related articles on 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!