//utf8mb4表情转换,用于存储 function textEncode($text){ $txtContent=json_encode($text); //\\\u[0-9a-f]{4} $txtContent=preg_replace_callback ('#(\\\u263a|\\\u2728|\\\u2b50|\\\u2753|\\\u270a|\\\u261d|\\\u2757|\\\ud[0-9a-f]{3}\\\ud[0-9a-f]{3})#',function($matches){ return addslashes($matches[1]);}, $txtContent); $txtContent=json_decode($txtContent); return $txtContent; } //表情反转,用于显示 function textDecode($text){ $txtContent=json_encode($text); $txtContent=preg_replace_callback ('#(\\\u263a|\\\u2728|\\\u2b50|\\\u2753|\\\u270a|\\\u261d|\\\u2757|\\\ud[0-9a-f]{3})#',function($matches){ print_r($matches);return stripslashes($matches[1]);}, $txtContent); $txtContent=json_decode($txtContent); return $txtContent; } $table = '
微信emoji表情及输入法自带表情存储与显示
最新推荐文章于 2024-09-14 07:04:58 发布