Home  >  Article  >  Backend Development  >  Solve the problem that php does not support Chinese insertion

Solve the problem that php does not support Chinese insertion

hzc
hzcOriginal
2020-06-05 13:39:413116browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn