Home >Backend Development >PHP Problem >How to solve the problem of garbled Chinese question marks in PHP
Solutions to garbled Chinese question marks in php: 1. Set the page header to "header('Content-Type: text/html; charset=UTF-8');"; 2. Set the character set to UTF8; 3. Set the Chinese field sorting rule to "utf8_general_ci".
Recommended: "PHP Video Tutorial"
About the solution to the problem that php mysql Chinese is displayed as a question mark
1. Header setting (sent to the browser)
header('Content-Type:text/html; charset=UTF-8');
2. Character set setting (note UTF8)
mysql_query('set names utf8');
3. The database involves Chinese The field sorting rule is utf8_general_ci
4. Modify the page content encoding format in the editor and store it in UTF-8 format
5. This step is generally enabled by default, but if the previous four steps If everything is correct and there is still a question mark display in Chinese, you need to check this step
Find and open my.ini in the mysql installation directory mysql\bin
Check whether character_set_server is equal to utf8 and the front The # (comment) should be removed
The above is the detailed content of How to solve the problem of garbled Chinese question marks in PHP. For more information, please follow other related articles on the PHP Chinese website!