The display in phpmyadmin is normal, but the output to the web page displays garbled characters. (This problem only occurred after I deployed it to the server) All Chinese characters turned into question marks, but everything in my local code was normal.
Set database connection string encoding utf8
Set the character encoding at database level, table level and field level to utf8_general_ci. If not set, the default is latin1_swedish_ci (gbk is supported, utf-8 encoding will cause garbled characters)
Beginners usually make the second mistake, because I did it too,
Encoding problems and compiler problems can also occur. Some default storage is not utf-8