Home > Article > Backend Development > Solve the problem that php does not support Chinese insertion
Solution to the problem that PHP does not support Chinese insertion:
I am thinking that your MySQL data encoding may be gbk. Possible solutions:
Execute before executing the insert statement: mysql_query("set names utf8");//Set the MySQL language to utf-8;
php can Use basedao_encode($Str) to force conversion to utf-8 encoding, that is, execute after obtaining the variable, and then insert.
#The price is: the data takes up about % more space than the original data.
Recommended tutorial: "php tutorial"
The above is the detailed content of Solve the problem that php does not support Chinese insertion. For more information, please follow other related articles on the PHP Chinese website!