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

How to solve the garbled problem of php echo alert

藏色散人
藏色散人Original
2021-06-10 09:04:572224browse

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 "3f1c4e4b6b16bbbd69b2ee476dc4f83a alert("Chinese") 2cacc6d41bbb37262a98f745aa00fbf0" Chinese garbled characters~~

I saw someone’s solution was to add

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

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!

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