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.
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");
or
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
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!