How to solve the problem of php html Chinese garbled characters

藏色散人
Release: 2023-03-04 07:12:02
Original
2473 people have browsed it

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" />
Copy after login

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");
?>
Copy after login

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!

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!