function filter_Emoji($string){
    $string = preg_replace('/[\x{1F600}-\x{1F64F}]/u', '', $string);
    $string = preg_replace('/[\x{1F300}-\x{1F5FF}]/u', '', $string);
    $string = preg_replace('/[\x{1F680}-\x{1F6FF}]/u', '', $string);
    $string = preg_replace('/[\x{2600}-\x{26FF}]/u', '', $string);
    $string = preg_replace('/[\x{2700}-\x{27BF}]/u', '', $string);
    $string = preg_replace('/[\x{10000}-\x{10FFFF}]/u', '', $string);
    $string = str_replace(array('"','\''), '', $string);
    return addslashes(trim($string));
}

可以将字段字符集改为utf8mb4,排序规则utf8mb4_general_ci

参考地址
https://www.cnblogs.com/richerdyoung/p/8184968.html

发表评论

邮箱地址不会被公开。 必填项已用*标注