Solution to Chinese garbled characters in PHP web pages:
Recommendation: php server
Method 1: Set the encoding in the php file Format, because the encoding format of the database is utf8, the encoding format of PHP is also utf8
Set the encoding method at the beginning of PHP, and also set the encoding format before SELECT
Method 2: WINDOWS, WIN R open the console and find the bin directory of mysql
Enter mysql
##Use the show variables commandmysql> show variables like 'char%'; You can see that the default encoding of character_set_database is latin1, we now want to change it to utf8
Find the my.ini file under MysqlAdd default-character-set=utf8 under client
##Add character-set under mysqld -server=utf8
Then restart the APCHE server and check the mysql encoding according to the previous command line
The above is the detailed content of PHP web page Chinese garbled code. For more information, please follow other related articles on the PHP Chinese website!