Home  >  Article  >  Backend Development  >  How to solve the problem of php html Chinese garbled characters

How to solve the problem of php html Chinese garbled characters

藏色散人
藏色散人Original
2020-08-08 10:57:012473browse

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

How to solve the problem of php html Chinese garbled characters

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!

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