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.
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\" >";
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!