Home > Backend Development > PHP Problem > How to solve the Chinese garbled problem in php echo?

How to solve the Chinese garbled problem in php echo?

青灯夜游
Release: 2023-02-28 18:58:01
Original
3589 people have browsed it

How to solve the Chinese garbled problem of php echo? The following article will introduce it to you. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to solve the Chinese garbled problem in php echo?

Concepts to understand:

Content-Type: used to define how the user's browser or related device displays what will be loaded The data, or how to process the data to be loaded

MIME: The MIME type is the type of file that sets a certain extension and is opened by an application. When the file with the extension is accessed , the browser will automatically use the specified application to open. It is mostly used to specify some client-defined file names and some media file opening methods.

text/html means to set the content-type of the file to the form of text/html. When the browser obtains such a file, it will automatically call the html parser to process the file accordingly. deal with.

text/plain means to set the file to plain text. The browser will not process this file when it obtains it.

Solution to php echo Chinese garbled problem:

Add header() statement in PHP:

<?php
header("Content-type:text/html;charset=utf-8");
?>
Copy after login

For more related knowledge, please pay attention to PHP中文网! !

The above is the detailed content of How to solve the Chinese garbled problem in php echo?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template