Solution to Chinese garbled html code: 1. Add "UTF-8" encoding to the head tag; 2. Add "header("content-type:text/html;charset=utf to the PHP file -8");".
Recommended: "PHP Video Tutorial"
1. Solve the problem of Chinese garbled characters in HTML pages
If your HTML text file has a chip problem, then you can add UTF-8 encoding (international encoding) in the head tag: UTF-8 is an encoding without a country, that is, an independent languages, any language can be used.
<meta http-equiv="content-Type" content="text/html;charset=utf-8" />
2, HTML and PHP mixed page solution
If you mix HTML and PHP, in addition to following the first In addition to the operations mentioned in this method, you also need to add this code to the PHP file:
<?php header("content-type:text/html;charset=utf-8"); ?>
The above is the detailed content of How to solve the problem of php html Chinese garbled characters. For more information, please follow other related articles on the PHP Chinese website!