北京网站开发哪里好薇,婚礼网站有哪些,西部数码官方网站,上海网站制作网站开发我们在通过PHP获取微信昵称#xff0c;并且存于数据库的时候#xff0c;由于一些昵称带有特殊符号#xff0c;所以存不进去#xff0c;这时候我们可以通过下面的方式来处理。方法二protected function removeEmoji($clean_text) {// Match Emoticons$regexEmoticons /[\x{…我们在通过PHP获取微信昵称并且存于数据库的时候由于一些昵称带有特殊符号所以存不进去这时候我们可以通过下面的方式来处理。方法二protected function removeEmoji($clean_text) {// Match Emoticons$regexEmoticons /[\x{1F600}-\x{1F64F}]/u;$clean_text preg_replace($regexEmoticons, , $clean_text);// Match Miscellaneous Symbols and Pictographs$regexSymbols /[\x{1F300}-\x{1F5FF}]/u;$clean_text preg_replace($regexSymbols, , $clean_text);// Match Transport And Map Symbols$regexTransport /[\x{1F680}-\x{1F6FF}]/u;$clean_text preg_replace($regexTransport, , $clean_text);// Match Miscellaneous Symbols$regexMisc /[\x{2600}-\x{26FF}]/u;$clean_text preg_replace($regexMisc, , $clean_text);// Match Dingbats$regexDingbats /[\x{2700}-\x{27BF}]/u;$clean_text preg_replace($regexDingbats, , $clean_text);return $clean_text;}方法二preg_replace(/[\x{1F600}-\x{1F64F}\x{1F300}-\x{1F5FF}\x{1F680}-\x{1F6FF}\x{2600}-\x{26FF}\x{2700}-\x{27BF}]/u,,这里是昵称)方法三// 过滤掉emoji表情function filterEmoji($str){$str preg_replace_callback( /./u,function (array $match) {return strlen($match[0]) 4 ? : $match[0];},$str);return $str;}相关学习推荐PHP编程从入门到精通