In the Thinkphp environment, Mysql stores Emoji
The default utf8 of Thinkphp does not support Emoji, because Emoji is unicode encoding, and each Emoji occupies 4 bytes. Just change the encoding of the data table and columns to utf8mb4.
Thinkphp's default utf8 does not support Emoji, because Emoji is unicode encoding, and each Emoji occupies 4 bytes, as follows:
1. Make sure the mysql version is greater than 5.3.3 (supports utf8mb4)
2. Change the table character set to utf8mb4, and the sort order is utf8mb4_general_ci
3. Change the field character set to utf8mb4, and the sort order is utf8mb4_general_ci
utf8mb4 is an extension of utf8 and is backward compatible. Remember to back up.
Some emoji are still displayed as question marks, please refer to the following:
Modify the data connection configuration 'database encoding' to: 'DB_CHARSET'=> 'utf8mb4',
The field character set also needs to be modified to uf8mb4
Only then can it be stored normally! ! ! !