您可以在数组中定义可转换字符,并使用
str_replace()
:
$conversions = array( "æ" => "ae","ñ" => "n",); $text = str_replace(array_keys($conversions),$conversions,$text);