Php solves the database garbled problem. If the database uses UTF-8, what encoding is your text? Use mb_convert_encoding or iconv to convert the encoding. The two codes must be consistent to avoid garbled characters. And if the database is using UTF-8, what encoding is your text?
Use mb_convert_encoding or iconv to convert the encoding. The two codes must be consistent to avoid garbled characters. There is also the database connection. if you add set names, all the connections should be added in that way. otherwise, garbled characters will be displayed.
If the following example does not undergo encoding conversion, the problem may occur.
$ FileName = "qtgz/qtgongzi.txt ";
$ FContent = file ($ fileName );
// Pay the value of the current element to $ a_content list and pay the value of the array element to some variables.
Foreach ($ fContent as $ a_content ){
List ($ QT_sfz, $ QT_xm, $ QT_bz, $ QT_je) = explode (",", $ a_content );
If ($ QT_sfz! = "" And $ QT_xm! = "" And $ QT_bz! = "" And $ QT_je! = ""){
Echo $ QT_xm;
// Insert the acquired time to the database
$ QT_sj = date ("Ym ");
$ Query = "insert into qita (QT_sfz, QT_xm, QT_bz, QT_je, QT_beizhu, QT_sj) values ('$ QT_sfz', '$ QT_xm', '$ QT_bz ', '$ QT_je', '$ QT_beizhu', '$ QT_sj ')";
// Echo $ query;
$ Rst = $ aa-> excu ($ query );
Why? Use mb_convert_encoding or iconv to convert the encoding. The two codes must be consistent to avoid garbled characters. And...