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.
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"); ?>
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!