美文网首页
php微信公众号过滤微信qq表情

php微信公众号过滤微信qq表情

作者: 小赐爱程序 | 来源:发表于2019-02-21 15:48 被阅读0次

微信公众号接收消息过滤微信qq表情的php代码,贼好用,特别全的

大家可以看到,默认输入的是各种类型的微信qq表情,输出结果为:111123123wq福尔摩杰、    。很好用哦

public function filterNicknameAction($nickname = '111[奸笑]123/::D/::D/::D123/::Dwq福尔摩杰♞、/::*/:X-)/:B-)/:,@!/:,@o/::d/:fade/:heart/:cake😔😔👻😄🐯 🐫 🐭 🐷 🌻 🐭 🐧 🗻 🍻 💚 💜 🎄 🎯 🎤 🏫 🌃 🗽 ♨ ⛎ ❔ 💯 🔑 👡 👜 💿 🇨🇳 🇬🇧 🇺🇸 ')

    {

        $nickname = preg_replace_callback(

            '/./u',

            function (array $match) {

                return strlen($match[0]) >= 4 ? '' : $match[0];

            },

            $nickname);

        $nickname = preg_replace('/[\x{1F600}-\x{1F64F}]/u', '', $nickname);

        $nickname = preg_replace('/[\x{1F300}-\x{1F5FF}]/u', '', $nickname);

        $nickname = preg_replace('/[\x{1F680}-\x{1F6FF}]/u', '', $nickname);

        $nickname = preg_replace('/[\x{2600}-\x{26FF}]/u', '', $nickname);

        $nickname = preg_replace('/[\x{2700}-\x{27BF}]/u', '', $nickname);

        $nickname = str_replace(array('"', '\''), '', $nickname);

        $nickname = preg_replace("/\[.*\]/", '', $nickname);

        $nickname = preg_replace("#/::\\)|/::~|/::B|/::\\||/:8-\\)|/::<|/::$|/::X|/::Z|/::'\\(|/::-\\||/::@|/::P|/::D|/::O|/::\\(|/::\\+|/:--b|/::Q|/::T|/:,@P|/:,@-D|/::d|/:,@o|/::g|/:\\|-\\)|/::!|/::L|/::>|/::,@|/:,@f|/::-S|/:\\?|/:,@x|/:,@@|/::8|/:,@!|/:!!!|/:xx|/:bye|/:wipe|/:dig|/:handclap|/:&-\\(|/:B-\\)|/:<@|/:@>|/::-O|/:>-\\||/:P-\\(|/::'\\||/:X-\\)|/::\\*|/:@x|/:8\\*|/:pd|/:<W>|/:beer|/:basketb|/:oo|/:coffee|/:eat|/:pig|/:rose|/:fade|/:showlove|/:heart|/:break|/:cake|/:li|/:bome|/:kn|/:footb|/:ladybug|/:shit|/:moon|/:sun|/:gift|/:hug|/:strong|/:weak|/:share|/:v|/:@\\)|/:jj|/:@@|/:bad|/:lvu|/:no|/:ok|/:love|/:<L>|/:jump|/:shake|/:<O>|/:circle|/:kotow|/:turn|/:skip|/:oY|/:\#\-0|/:hiphot|/:kiss|/:<&|/:&>#", '', $nickname);

        echo $nickname;

    }

//输出结果为:111123123wq福尔摩杰、

相关文章

网友评论

      本文标题:php微信公众号过滤微信qq表情

      本文链接:https://www.haomeiwen.com/subject/fqvcyqtx.html