$string = iconv('utf-8','ASCII//IGNORE//TRANSLIT',$string);
Run Code Online (Sandbox Code Playgroud)
您可以使用htmlentities()to 转换é为é,然后使用正则表达式在 & 号后拉出第一个字符。
function RemoveAccents($string) {
// From http://theserverpages.com/php/manual/en/function.str-replace.php
$string = htmlentities($string);
return preg_replace("/&([a-z])[a-z]+;/i", "$1", $string);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7608 次 |
| 最近记录: |