php – 如何将特殊字符转换为普通字符?

前端之家收集整理的这篇文章主要介绍了php – 如何将特殊字符转换为普通字符?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图转换像下面的字符:
ë,ä,ï,ö,etc.

对于普通字符,例如:

e,a,i,o,etc.

做这个的最好方式是什么?
我尝试过很多东西,比如preg_replace和str_replace.

有人可以帮我吗?

– 编辑 –

我试过的是:

$ts = array("[À-Å]","Æ","Ç","[È-Ë]","/[Ì-Ï]/","/Ð/","/Ñ/","/[Ò-ÖØ]/","/×/","/[Ù-Ü]/","/[Ý-ß]/","/[à-å]/","/æ/","/ç/","/[è-ë]/","/[ì-ï]/","/ð/","/ñ/","/[ò-öø]/","/÷/","/[ù-ü]/","/[ý-ÿ]/");

$tn = array("A","AE","C","E","I","D","N","O","X","U","Y","a","ae","c","e","i","d","n","o","x","u","y");

$title = preg_replace($ts,$tn,$text);
试试这个……对我有用.
iconv('utf-8','ascii//TRANSLIT',$text);
原文链接:https://www.f2er.com/php/136297.html

猜你在找的PHP相关文章