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

How to solve the garbled problem of php echo alert

藏色散人
Release: 2023-03-10 13:20:02
Original
2321 people have browsed it

php echo alert garbled solution: first open the corresponding PHP code file; then add the statement "header("Content-Type:text/html;charset=utf-8")" to the method. Solve the problem of garbled characters.

How to solve the garbled problem of php echo alert

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

How to solve the php echo alert garbled problem?

Specific question:

php echo "<script> alert("Chinese") </script>" Chinese garbled characters~~

I saw someone’s solution was to add

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

and I debugged it, but it still didn’t work. Why does this problem occur and how to solve it?

Solution:

Add a header("Content-Type:text/html;charset=utf-8") to the method Can!

【Recommended learning: PHP video tutorial

The above is the detailed content of How to solve the garbled problem of php echo alert. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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