Convert emoji to UTF8 and store to database, but inefficient
1 Public functionRrr$text) {2 $text= ' A?? Ss?? Ss?? ss;3 //emoji symbols for handling names4 $tmpStr= Json_encode ($text);//exposing the Unicode5 6 $TMPSTR 1=Preg_replace_callback("# (\\\ue[0-9a-f]{3}) #i",function($a) {7 //var_dump ($a);8 return addslashes($a[1]);9 //return $a;Ten},$tmpStr); One $text= Json_decode ($TMPSTR 1); A return $TMPSTR 1; -}
Direct MySQL support: Requires more than 5.5 of the version
default character Set:utf8mb4. default collection:utf8mb4_general_ci; corresponding table: Commentdefault character Set:utf8mb4. default collection:utf8mb4_general_ci; corresponding field: Content: Character Set:utf8mb4. Collection:utf8mb4_general_ci;
PHP-side database encoding to be changed to UTF8MB4
It's relatively perfect.
PHP MySQL support emoji expression scheme