Home > Backend Development > PHP Problem > How to solve the problem of garbled characters in php alert

How to solve the problem of garbled characters in php alert

藏色散人
Release: 2023-03-02 07:38:01
Original
2485 people have browsed it

The way to solve the garbled problem of php alert is to add the statement "<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> to the php page " is all.

How to solve the problem of garbled characters in php alert

Solution to php alert garbled problem

When making a web website, it is best to use utf8 format for character encoding, gb2312 Traditional Chinese characters are not supported

If it was gb2312 before, you can use emeditor or other editors to save the file as utf8

Each html file must have a header< ;meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

When there is an alert statement in the php page, if If it is not included by other pages with header files, you must add:

header("content-type:text/html; charset=utf-8");
Copy after login

or

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Copy after login

to the php page so that there will be no garbled code problems.

For more related knowledge, please visit PHP Chinese website!

The above is the detailed content of How to solve the problem of garbled characters in php alert. 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