php 如何用正则表达式 去掉字符串中的拼音?

2024-11-29 22:18:18
推荐回答(1个)
回答1:

//-- 程序名称:strreplace()
    //-- 程序用途:替换变量中的非法字符
    //-- 传入参数:变量值
    //********************************************************
   
 function strreplace($str){
      $str = strips教程lashes($str);
      $str = str_replace(chr(92),'',$str);
      $str = str_replace(chr(47),'',$str);
      $str = str_replace(chr(10).chr(13),"
",$str);
      $str = str_replace('<',"<",$str);
      $str = str_replace('>',">",$str);
      $str = str_replace(';',";",$str);
      $str = str_replace('"',"“",$str);
      $str = str_replace("'","‘",$str);
      $str = str_replace(" "," ",$str);
      $str = str_replace("/**/"," ",$str);
      return trim($str);
    }